@@ -12,6 +12,7 @@ Symfony Application Checklist
12
12
-----------------------------
13
13
14
14
#. :ref: `Install APCu Polyfill if your server uses APC <performance-install-apcu-polyfill >`
15
+ #. :ref: `Dump the service container into a single file <performance-service-container-single-file >`
15
16
16
17
Production Server Checklist
17
18
---------------------------
@@ -33,6 +34,51 @@ OPcache, install the `APCu Polyfill component`_ in your application to enable
33
34
compatibility with `APCu PHP functions `_ and unlock support for advanced Symfony
34
35
features, such as the APCu Cache adapter.
35
36
37
+ .. _performance-service-container-single-file :
38
+
39
+ Dump the Service Container into a Single File
40
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41
+
42
+ .. versionadded :: 4.4
43
+
44
+ The ``container.dumper.inline_factories `` parameter was introduced in
45
+ Symfony 4.4.
46
+
47
+ Symfony compiles the :doc: `service container </service_container >` into multiple
48
+ small files by default. Set this parameter to ``true `` to compile the entire
49
+ container into a single file, which could improve performance when using
50
+ "class preloading" in PHP 7.4 or newer versions:
51
+
52
+ .. configuration-block ::
53
+
54
+ .. code-block :: yaml
55
+
56
+ # config/services.yaml
57
+ parameters :
58
+ # ...
59
+ container.dumper.inline_factories : true
60
+
61
+ .. code-block :: xml
62
+
63
+ <!-- config/services.xml -->
64
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
65
+ <container xmlns =" http://symfony.com/schema/dic/services"
66
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
67
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd" >
68
+
69
+ <parameters >
70
+ <!-- ... -->
71
+ <parameter key =" container.dumper.inline_factories" >true</parameter >
72
+ </parameters >
73
+ </container >
74
+
75
+ .. code-block :: php
76
+
77
+ // config/services.php
78
+
79
+ // ...
80
+ $container->setParameter('container.dumper.inline_factories', true);
81
+
36
82
.. _performance-use-opcache :
37
83
38
84
Use the OPcache Byte Code Cache
0 commit comments