Skip to content

Commit 580f96f

Browse files
wouterjxabbuh
authored andcommitted
Add DebugBundle config reference
1 parent beaa7a4 commit 580f96f

File tree

4 files changed

+87
-28
lines changed

4 files changed

+87
-28
lines changed

components/var_dumper/introduction.rst

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ use instead of e.g. :phpfunction:`var_dump`. By using it, you'll gain:
4242
For example::
4343

4444
require __DIR__.'/vendor/autoload.php';
45+
4546
// create a variable, which could be anything!
46-
$someVar = '...';
47+
$someVar = ...;
4748

4849
dump($someVar);
4950

@@ -70,14 +71,14 @@ current PHP SAPI:
7071
#. Run ``composer global require symfony/var-dumper``;
7172
#. Add ``auto_prepend_file = ${HOME}/.composer/vendor/autoload.php``
7273
to your ``php.ini`` file;
73-
#. From time to time, run ``composer global update`` to have the latest
74-
bug fixes.
74+
#. From time to time, run ``composer global update symfony/var-dumper``
75+
to have the latest bug fixes.
7576

7677
DebugBundle and Twig Integration
7778
--------------------------------
7879

79-
The ``DebugBundle`` allows greater integration of the component into the
80-
Symfony full stack framework. It is enabled by default in the *dev* and *test*
80+
The DebugBundle allows greater integration of the component into the Symfony
81+
full-stack framework. It is enabled by default in the *dev* and *test*
8182
environment of the standard edition since version 2.6.
8283

8384
Since generating (even debug) output in the controller or in the model
@@ -98,29 +99,9 @@ Choosing between both is mostly a matter of personal taste, still:
9899
be suited to your use case (e.g. you shouldn't use it in an HTML
99100
attribute or a ``<script>`` tag).
100101

101-
By default for nested variables, dumps are limited to a subset of their
102-
original value. You can configure the limits in terms of:
103-
104-
* maximum number of items to dump,
105-
* maximum string length before truncation.
106-
107-
.. configuration-block::
108-
109-
.. code-block:: yaml
110-
111-
debug:
112-
max_items: 250
113-
max_string_length: -1
114-
115-
.. code-block:: xml
116-
117-
<?xml version="1.0" encoding="UTF-8" ?>
118-
<container xmlns="http://symfony.com/schema/dic/debug"
119-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
120-
xsi:schemaLocation="http://symfony.com/schema/dic/debug http://symfony.com/schema/dic/debug/debug-1.0.xsd">
121-
122-
<config max-items="250" max-string-length="-1" />
123-
</container>
102+
This behaviour can be changed by configuring the ``dump.dump_destination``
103+
option. Read more about this and other options in
104+
:doc:`the DebugBundle configuration reference </reference/configuration/debug>`.
124105

125106
Using the VarDumper Component in your PHPUnit Test Suite
126107
--------------------------------------------------------

reference/configuration/debug.rst

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
.. index::
2+
single: Configuration reference; Framework
3+
4+
DebugBundle Configuration ("debug")
5+
===================================
6+
7+
The DebugBundle allows greater integration of the
8+
:doc:`VarDumper component </components/var_dumper/introduction>` in the
9+
Symfony full-stack framework and can be configured under the ``debug`` key
10+
in your application configuration. When using XML, you must use the
11+
``http://symfony.com/schema/dic/debug`` namespace.
12+
13+
.. versionadded::
14+
The DebugBundle was introduced in Symfony 2.6.
15+
16+
.. tip::
17+
18+
The XSD schema is available at
19+
``http://symfony.com/schema/dic/debug/debug-1.0.xsd``.
20+
21+
Configuration
22+
-------------
23+
24+
* `max_items`_
25+
* `max_string_length`_
26+
* `dump_destination`_
27+
28+
max_items
29+
~~~~~~~~~
30+
31+
**type**: ``integer`` **default**: ``2500``
32+
33+
This is the maximum number of items to dump. Setting this option to ``-1``
34+
disables the limit.
35+
36+
max_string_length
37+
~~~~~~~~~~~~~~~~~
38+
39+
**type**: ``integer`` **default**: ``-1``
40+
41+
This option configures the maximum string length before truncating the
42+
string. The default value (``-1``) means that strings are never truncated.
43+
44+
dump_destination
45+
~~~~~~~~~~~~~~~~
46+
47+
**type**: ``string`` **default**: ``null``
48+
49+
Configures the output destination of the dumps.
50+
51+
By default, the dumps are shown in the toolbar. Since this is not always
52+
possible (e.g. when working on a JSON API), you can have an alternate output
53+
destination for dumps. Typically, you would set this to ``php://stderr``:
54+
55+
.. configuration-block::
56+
57+
.. code-block:: yaml
58+
59+
debug:
60+
dump_destination: php://stderr
61+
62+
.. code-block:: xml
63+
64+
<?xml version="1.0" encoding="UTF-8" ?>
65+
<container xmlns="http://symfony.com/schema/dic/debug"
66+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
67+
xsi:schemaLocation="http://symfony.com/schema/dic/debug http://symfony.com/schema/dic/debug/debug-1.0.xsd">
68+
69+
<config dump-destination="php://stderr" />
70+
</container>
71+
72+
.. code-block:: php
73+
74+
$container->loadFromExtension('debug', array(
75+
'dump_destination' => 'php://stderr',
76+
));

reference/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Reference Documents
1212
configuration/twig
1313
configuration/monolog
1414
configuration/web_profiler
15+
configuration/debug
1516

1617
configuration/kernel
1718

reference/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* :doc:`twig </reference/configuration/twig>`
1414
* :doc:`monolog </reference/configuration/monolog>`
1515
* :doc:`web_profiler </reference/configuration/web_profiler>`
16+
* :doc:`debug </reference/configuration/debug>` (new in 2.6)
1617

1718
* :doc:`Configuring the Kernel (e.g. AppKernel) </reference/configuration/kernel>`
1819

0 commit comments

Comments
 (0)