Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1635e1f

Browse files
committed
minor #17954 [DependencyInjection] Disable dumping the container as XML in debug mode (ruudk)
This PR was merged into the 6.3 branch. Discussion ---------- [DependencyInjection] Disable dumping the container as XML in debug mode Closes #17952 Commits ------- 4c49b0e Disable dumping the container as XML in debug mode
2 parents b0568f3 + 4c49b0e commit 1635e1f

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

performance.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,47 @@ deployment process too):
217217
used in your application and prevents Composer from scanning the file system for
218218
classes that are not found in the class map. (see: `Composer's autoloader optimization`_).
219219

220+
Disable Dumping the Container as XML in Debug Mode
221+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
222+
223+
In debug mode, Symfony compiles the :doc:`service container </service_container>`
224+
into an XML file. This XML file is used by various commands such as
225+
``debug:container`` and ``debug:autowiring``. When the container grows larger and larger,
226+
so does the size of the file and the time to generate it. Sometimes the benefit of this
227+
file does not outweigh the decrease in performance.
228+
229+
In these situations, you can disable dumping of the XML file by setting `debug.container.dump` to `false`:
230+
231+
.. configuration-block::
232+
233+
.. code-block:: yaml
234+
235+
# config/services.yaml
236+
parameters:
237+
# ...
238+
debug.container.dump: false
239+
240+
.. code-block:: xml
241+
242+
<!-- config/services.xml -->
243+
<?xml version="1.0" encoding="UTF-8" ?>
244+
<container xmlns="http://symfony.com/schema/dic/services"
245+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
246+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
247+
248+
<parameters>
249+
<!-- ... -->
250+
<parameter key="debug.container.dump">false</parameter>
251+
</parameters>
252+
</container>
253+
254+
.. code-block:: php
255+
256+
// config/services.php
257+
258+
// ...
259+
$container->parameters()->set('debug.container.dump', false);
260+
220261
.. _profiling-applications:
221262

222263
Profiling Symfony Applications

0 commit comments

Comments
 (0)