Deactivate the profiler (debug bar) at the same time as the debug mode with Symfony

Published on 2023-01-02 • Modified on 2023-01-02

This snippet shows how to deactivate the profiler (debug bar) simultaneously wit the debug mode with Symfony. We can use this little trick and use the %kernel.debug% parameter instead of putting a boolean: this avoids managing an additional parameter for that. Indeed, it seems weird to display the profiler while having the debug mode disabled.


# config/packages/dev/web_profiler.yaml
web_profiler:
    toolbar: '%kernel.debug%'
    intercept_redirects: false

 More on Stackoverflow   Read the doc  Random snippet