QuickTip: Turn symfony’s web profiler debug bar on or off

Check out your config_dev.yml and you will notice a special section over there

web_profiler:
    toolbar: true
    intercept_redirects: false

You can turn the debug bar on or off anytime by changing the value of toolbar in this web_profiler section.

If you want to turn debug bar off for a specific controller action, you can do so by the following line. This will actually stop the profiler for the current action.

$this->container->get('profiler')->disable();

Enjoy!

About these ads

One thought on “QuickTip: Turn symfony’s web profiler debug bar on or off

  1. To be exact, “$this->container->get(‘profiler’)->disable();“ will not disable only the toolbar but the whole profiler. So it is not only hiding the toolbar. It also prevents collecting the data (which can be accessed using the search in the web profiler even when you don’t have the toolbar).

    Disabling the profiler itself is done in the FrameworkBundle configuration (WebProfilerBundle is only about the profile UI, not about the profiling itself):

    framework:
    profiler:
    collect: false

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s