@@ -23,11 +23,8 @@ You can install the component in 2 different ways:
23
23
The dump() function
24
24
-------------------
25
25
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:
31
28
32
29
- per object and resource types specialized view to e.g. filter out
33
30
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
47
44
:method: `VarDumper::setHandler($callable) <Symfony\\ Component\\ VarDumper\\ VarDumper::setHandler> `:
48
45
calls to ``dump() `` will then be forwarded to ``$callable ``.
49
46
50
- Where does the output go?
51
- -------------------------
47
+ Output format and destination
48
+ -----------------------------
52
49
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.
55
52
56
53
By default, these are selected based on your current PHP SAPI:
57
54
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
59
56
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
61
58
dumps from regular output by using pipe redirection.
62
59
- on other SAPIs, dumps are written as HTML on the regular output.
63
60
64
61
DebugBundle and Twig integration
65
62
--------------------------------
66
63
67
- The `DebugBundle ` allows greater integration of the component into the
64
+ The `` DebugBundle ` ` allows greater integration of the component into the
68
65
Symfony full stack framework. It is enabled by default in the dev
69
66
environement of the standard edition since version 2.6.
70
67
71
68
Since generating (even debug) output in the controller or in the model
72
69
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
74
71
variables are dumped in the web debug toolbar.
75
72
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 ` `
77
74
or a fatal error occurred, then dumps are written on the regular output.
78
75
79
76
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 :
81
78
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
83
80
shall not be modified: variables are not dumped inline, but in the web
84
81
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
86
83
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 >
88
108
89
109
Reading a dump
90
110
--------------
0 commit comments