Edit on GitHub
Jump to docs navigation

Bolt Internals / dump() Twig tag

Note: You are currently reading the documentation for Bolt 2.2. Looking for the documentation for Bolt 5.2 instead?

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. In templates, use the following:

    {{ dump(variable) }}

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

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.

Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.