BoltCM

Sophisticated, Lightweight and Simple

Jump to docs navigation
Edit on GitHub

Note: You are currently reading the documentation for Bolt 3.0. Looking for the documentation for Bolt 3.2 instead?

Internals ยป dump() Twig tag

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;

    VarDumper::dump($variable);

Or, using the (global) shortcut:

    dump($variable);

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.