8000 [Debug] Create a main guide for Debugging by wouterj · Pull Request #7071 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Debug] Create a main guide for Debugging #7071

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 7 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added the VarDumper to the debug/debugging page
Conflicts:
	debug/debugging.rst
  • Loading branch information
hiddewie authored and wouterj committed Oct 7, 2017
commit 4c065fde68f44c10f695dfc2201114a3e1ebd4b3
25 changes: 25 additions & 0 deletions debug.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,28 @@ that can help you visualize and find the information.

When in doubt how to use a console command, open the help section by
appending the ``--help`` option.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(-h)


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.
0