Sophisticated, Lightweight and Simple

Jump to docs navigation
Edit on GitHub

Debugging » Dumping

If you're coding and you want to get a quick look at whatever variable or object you're trying to manipulate, you can dump its contents to the browser.

Note: Don't forget to set debug: true in your config.yml file. Otherwise the dump() will output nothing at all.


In templates, use the following:

    {{ dump(variable) }}

The variable can be a normal variable, a Record or multiple records of Content, or other stuff.


In your code you can also dump variables and objects, like this:

    use Symfony\Component\VarDumper\VarDumper;


Or, using the (global) shortcut:


Like above, the $variable can be a normal variable, an object or whatever.

Note that Bolt has built-in protection for when you're tyring to 'dump' Silex or Symfony objects like $app or a variable that's \Bolt\Application.

Since these would be too large to render because of internal references and recursion, they are not expanded further.

Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on IRC.
Spotted a typo, or have something to add? Edit this page on GitHub.