Skip to content

Added the VarDumper to the debug/debugging page #7022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions debug/debugging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,28 @@ locations. To avoid problems, you can either tell your IDE to ignore the PHP
cache files, or you can change the extension used by Symfony for these files::

$kernel->loadClassCache('classes', '.php.cache');

Using the VarDumper
-------------------

To ease the debugging of a variable in your application, you can use the
``VarDumper`` component to dump the content of a variable. The component
provides an alternative to the PHP ``var_dump`` function, in the form of
``dump``.

It is as easy as the code below::

// Create a variable with a value...
$myVar = ...;

// ... and dump it
dump($myVar);

.. tip::

The dumper is not limited to scalar values. Arrays and objects can also be
visualized using the ``VarDumper``.

If the dumper is used on a command line, the result is a formatted string.
Otherwise, the result is a piece of HTML, which can be expanded to show nested
structures in the dumped value.