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?

Debugging Bolt

Sections:

Configuring Bolt

When debugging in Bolt, often you'll need to adjust settings in your app/config/config.yml file.

Enabling debugging

Ensure you have debugging enabled:

debug: true

Warning: When debug: true is set, some internal data can be visible during debugging. You should therefore use caution with enabling debugging in a production environment.

Setting debug error level

It is also advised to set the debug error level to show all errors:

debug_error_level: -1

Enabling debug logging

Enabling the debug log writes the default application logger's messages to app/cache/bolt-debug.log.

debuglog:
    enabled: true

Note: This file's size can grow quickly.

Enabling debugging while logged off

If you're debugging problems on a development server, and are missing a login token, the debug bar, and dumping functions will not appear.

Setting debug_show_loggedoff will enable the debug bar, and dump output always.

debug_show_loggedoff: true

Warning: This should only be enabled in non-production environments.

Twig

When writing and debugging Twig templates in Bolt, enable strict_variables in your app/config/config.yml file, making Twig be strict on the use of undeclared variables.

strict_variables: true

For debugging inside Twig templates themselves, see the dump and backtrace sections.

Of course the debug bar has profiling information available when hovering over the Twig profiler icon, or a listing of templates used, and a render call graph that can be useful to track down templates that are causing slow page rendering.

PHP

The debug bar provides comprehensive information on:

Basic

For very basic debugging on PHP problems, Bolt has its own dump and backtrace functions available.

Advanced

However, while more complex to set up, using xdebug in an IDE such as PhpStorm, Atom, VSCode, or Eclipse will make debugging PHP code so much simpler.

Also of worthy note, PhpStorm has the Silex Pimple plugin available, that makes getting PHPDoc information, code completion, and method parameter checking all work for keys on $app.


Other pages in this section:


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.