8000 § about DebugBundle config · symfony/symfony-docs@6a3e170 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6a3e170

Browse files
§ about DebugBundle config
1 parent cb0ee89 commit 6a3e170

File tree

2 files changed

+42
-21
lines changed

2 files changed

+42
-21
lines changed

components/var_dumper/advanced.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ Before dumping it, you can further limit the resulting
3131
:class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object by calling its
3232
:method:`Symfony\\Component\\VarDumper\\Cloner\\Data::getLimitedClone`
3333
method:
34-
- the first `$maxDepth` argument allows limiting dumps in the depth dimension,
35-
- the second `$maxItemsPerDepth` limits the number of items per depth level,
36-
- and the last `$useRefHandles` defaults to `true` but allows removing internal
34+
35+
- the first ``$maxDepth`` argument allows limiting dumps in the depth dimension,
36+
- the second ``$maxItemsPerDepth`` limits the number of items per depth level,
37+
- and the last ``$useRefHandles`` defaults to ``true`` but allows removing internal
3738
objects' handles for sparser output,
3839
- but unlike the previous limits on cloners that remove data on purpose, these
3940
limits can be changed back and forth before dumping since they do not affect

components/var_dumper/introduction.rst

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@ You can install the component in 2 different ways:
2323
The dump() function
2424
-------------------
2525

26-
The VarDumper component creates a global ``dump()`` function that is
27-
configured out of the box: HTML or CLI output is automatically selected based
28-
on the current PHP SAPI.
29-
30-
The advantages of this function are:
26+
The VarDumper component creates a global ``dump()`` function that you can
27+
use instead of e.g. :phpfunction:`var_dump`. By using it, you'll gain:
3128

3229
- per object and resource types specialized view to e.g. filter out
3330
Doctrine internals while dumping a single proxy entity, or get more
@@ -47,44 +44,67 @@ You can change the behavior of this function by calling
4744
:method:`VarDumper::setHandler($callable) <Symfony\\Component\\VarDumper\\VarDumper::setHandler>`:
4845
calls to ``dump()`` will then be forwarded to ``$callable``.
4946

50-
Where does the output go?
51-
-------------------------
47+
Output format and destination
48+
-----------------------------
5249

53-
If you read the advanced documentation, you'll learn how to change the
54-
format or redirect the output to wherever you want.
50+
If you read the `advanced documentation <advanced>`, you'll learn how to
51+
change the format or redirect the output to wherever you want.
5552

5653
By default, these are selected based on your current PHP SAPI:
5754

58-
- on the command line (CLI SAPI), the output is written on `STDERR`. This
55+
- on the command line (CLI SAPI), the output is written on ``STDERR``. This
5956
can be surprising to some because this bypasses PHP's output buffering
60-
mechanism. On the other hand, this give the possibility to easily split
57+
mechanism. On the other hand, it give the possibility to easily split
6158
dumps from regular output by using pipe redirection.
6259
- on other SAPIs, dumps are written as HTML on the regular output.
6360

6461
DebugBundle and Twig integration
6562
--------------------------------
6663

67-
The `DebugBundle` allows greater integration of the component into the
64+
The ``DebugBundle`` allows greater integration of the component into the
6865
Symfony full stack framework. It is enabled by default in the dev
6966
environement of the standard edition since version 2.6.
7067

7168
Since generating (even debug) output in the controller or in the model
7269
of your application may just break it by e.g. sending HTTP headers or
73-
corrupting your view, the bundle configures the `dump()` function so that
70+
corrupting your view, the bundle configures the ``dump()`` function so that
7471
variables are dumped in the web debug toolbar.
7572

76-
But if the toolbar can not be displayed because you e.g. called `die`/`exit`
73+
But if the toolbar can not be displayed because you e.g. called ``die``/``exit``
7774
or a fatal error occurred, then dumps are written on the regular output.
7875

7976
In a Twig template, two constructs are available for dumping a variable.
80-
Choosing between both is generally only a matter of personal taste:
77+
Choosing between both is mostly a matter of personal taste, still:
8178

82-
- `{% dump foo.bar %}` is the way to go when the original template output
79+
- ``{% dump foo.bar %}`` is the way to go when the original template output
8380
shall not be modified: variables are not dumped inline, but in the web
8481
debug toolbar.
85-
- on the contrary, `{{ dump(foo.bar) }}` dumps inline and thus may or not
82+
- on the contrary, ``{{ dump(foo.bar) }}`` dumps inline and thus may or not
8683
be suited to your use case (e.g. you shouldn't use it in an HTML
87-
attribute or a `script` tag).
84+
attribute or a ``<script>`` tag).
85+
86+
By default for nested variables, dumps are limited to a subset of their
87+
original value. You can configure the limits in terms of:
88+
- maximum number of items to dump,
89+
- maximum string length before truncation.
90+
91+
.. configuration-block::
92+
93+
.. code-block:: yaml
94+
95+
debug:
96+
max_items: 250
97+
max_string_length: -1
98+
99+
.. code-block:: xml
100+
101+
<?xml version="1.0" encoding="UTF-8" ?>
102+
<container xmlns="http://symfony.com/schema/dic/debug"
103+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
104+
xsi:schemaLocation="http://symfony.com/schema/dic/debug http://symfony.com/schema/dic/debug/debug-1.0.xsd">
105+
106+
<config max-items="250" max-string-length="-1" />
107+
</container>
88108
89109
Reading a dump
90110
--------------

0 commit comments

Comments
 (0)
0