@@ -14,6 +14,8 @@ Tag Name Usage
14
14
`auto_alias `_ Define aliases based on the value of container parameters
15
15
`console.command `_ Add a command
16
16
`container.hot_path `_ Add to list of always needed services
17
+ `container.no_preload `_ Remove a class from the list of classes to preload by PHP
18
+ `container.preload `_ Add some class to the list of classes to preload by PHP
17
19
`controller.argument_value_resolver `_ Register a value resolver for controller arguments such as ``Request ``
18
20
`data_collector `_ Create a class that collects custom data for the profiler
19
21
`doctrine.event_listener `_ Add a Doctrine event listener
@@ -212,6 +214,109 @@ for services and their class hierarchy. The result is as significant performance
212
214
213
215
Use this tag with great caution, you have to be sure that the tagged service is always used.
214
216
217
+ .. _dic-tags-container-nopreload :
218
+
219
+ container.no_preload
220
+ --------------------
221
+
222
+ **Purpose **: Remove a class from the list of classes to preload by PHP
223
+
224
+ .. versionadded :: 5.1
225
+
226
+ The ``container.no_preload `` tag was introduced in Symfony 5.1.
227
+
228
+ When using `PHP class preloading `_, this tag allows you to define that some
229
+ class should not be preloaded by PHP. Add this tag to any service and its
230
+ related class won't be preloaded:
231
+
232
+ .. configuration-block ::
233
+
234
+ .. code-block :: yaml
235
+
236
+ services :
237
+ App\SomeNamespace\SomeService :
238
+ tags : ['container.no_preload']
239
+
240
+ .. code-block :: xml
241
+
242
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
243
+ <container xmlns =" http://symfony.com/schema/dic/services"
244
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
245
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
246
+ https://symfony.com/schema/dic/services/services-1.0.xsd" >
247
+
248
+ <services >
249
+ <service id =" App\SomeNamespace\SomeService" >
250
+ <tag name =" container.no_preload" />
251
+ </service >
252
+ </services >
253
+ </container >
254
+
255
+ .. code-block :: php
256
+
257
+ use App\SomeNamespace\SomeService;
258
+
259
+ $container
260
+ ->register(SomeService::class)
261
+ ->addTag('container.no_preload')
262
+ ;
263
+
264
+ .. _dic-tags-container-preload :
265
+
266
+ container.preload
267
+ -----------------
268
+
269
+ **Purpose **: Add some class to the list of classes to preload by PHP
270
+
271
+ .. versionadded :: 5.1
272
+
273
+ The ``container.preload `` tag was introduced in Symfony 5.1.
274
+
275
+ When using `PHP class preloading `_, this tag allows you to define which PHP
276
+ classes should be preloaded. This can improve performance by making some of the
277
+ classes used by your service always available for all requests:
278
+
279
+ .. configuration-block ::
280
+
281
+ .. code-block :: yaml
282
+
283
+ services :
284
+ App\SomeNamespace\SomeService :
285
+ tags :
286
+ - { name: 'container.preload', class: 'App\SomeClass' }
287
+ - { name: 'container.preload', class: 'App\Some\OtherClass' }
288
+ # ...
289
+
290
+ .. code-block :: xml
291
+
292
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
293
+ <container xmlns =" http://symfony.com/schema/dic/services"
294
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
295
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
296
+ https://symfony.com/schema/dic/services/services-1.0.xsd" >
297
+
298
+ <services >
299
+ <service id =" App\SomeNamespace\SomeService" >
300
+ <tag name =" container.preload" class =" App\SomeClass" />
301
+ <tag name =" container.preload" class =" App\Some\OtherClass" />
302
+ <!-- ... -->
303
+ </service >
304
+ </services >
305
+ </container >
306
+
307
+ .. code-block :: php
308
+
309
+ use App\Some\OtherClass;
310
+ use App\SomeClass;
311
+ use App\SomeNamespace\SomeService;
312
+
313
+ $container
314
+ ->register(SomeService::class)
315
+ ->addTag('container.preload', ['class' => SomeClass::class)
316
+ ->addTag('container.preload', ['class' => OtherClass::class)
317
+ // ...
318
+ ;
319
+
215
320
controller.argument_value_resolver
216
321
----------------------------------
217
322
@@ -1214,3 +1319,4 @@ Bridge.
1214
1319
.. _`Twig's documentation` : https://twig.symfony.com/doc/2.x/advanced.html#creating-an-extension
1215
1320
.. _`SwiftMailer's Plugin Documentation` : https://swiftmailer.symfony.com/docs/plugins.html
1216
1321
.. _`Twig Loader` : https://twig.symfony.com/doc/2.x/api.html#loaders
1322
+ .. _`PHP class preloading` : https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.preload
0 commit comments