Edit on GitHub
Jump to docs navigation

Debugging / Backtracing

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

Using this function you can get the array of a backtrace through the code to the current point in the execution. Useful for when you're debugging something, and you're not quite sure how you got here to begin with.


In your templates, use the following:

    {{ dump(backtrace()) }}

The optional parameters denote the options and maximum depth of the output of the backtrace. See the page on php.net: debug-backtrace.php(). The Twig filter defaults to using DEBUG_BACKTRACE_IGNORE_ARGS, to use considerably less memory.


In your code you can also use backtrace, like this:

    use Symfony\Component\VarDumper\VarDumper;


Or, using the (global) shortcut:


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.