Skip to content

Commit bbee06d

Browse files
hiddewiewouterj
authored andcommitted
Added the VarDumper to the debug/debugging page
Conflicts: debug/debugging.rst
1 parent 017182f commit bbee06d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

debug.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,28 @@ that can help you visualize and find the information.
8585

8686
When in doubt how to use a console command, open the help section by
8787
appending the ``--help`` option.
88+
89+
Using the VarDumper
90+
-------------------
91+
92+
To ease the debugging of a variable in your application, you can use the
93+
``VarDumper`` component to dump the content of a variable. The component
94+
provides an alternative to the PHP ``var_dump`` function, in the form of
95+
``dump``.
96+
97+
It is as easy as the code below::
98+
99+
// Create a variable with a value...
100+
$myVar = ...;
101+
102+
// ... and dump it
103+
dump($myVar);
104+
105+
.. tip::
106+
107+
The dumper is not limited to scalar values. Arrays and objects can also be
108+
visualized using the ``VarDumper``.
109+
110+
If the dumper is used on a command line, the result is a formatted string.
111+
Otherwise, the result is a piece of HTML, which can be expanded to show nested
112+
structures in the dumped value.

0 commit comments

Comments
 (0)