Search code examples
phplaraveldebuggingproduction-environment

I can't turn off debug bar in Laravel on production


I have set

'enabled' = false

in both package and in config/debugbar.php

I cleared cache with

php artisan cache:clear

but I still see it on production environment. I accidently commited

'enabled' = false

by accident and can't turn it off. I even rolled back commits, but that doesn't help. Any ideas?

@edit the .env has also debug set to false

@edit2 also when I got ot /login route on new browser (or private mode) I don't see the bar, but when I refresh this page, it is there again


Solution

  • Solution for 5.5 and above

    Install the package with:

    composer require barryvdh/laravel-debugbar:dev-master
    

    Because of the package auto-discovery feature, you don't need to add package's service provider to the providers list in config/app.php and Debugbar will only be loaded in the development environment.

    Solution for 5.4 and below

    Put this code to the AppServiceProvider@register:

    if ($this->app->isLocal()) {
        $this->app->register('Barryvdh\Debugbar\ServiceProvider');
    }
    

    Don't forget to remove Laravel Debugbar line from config/app.php providers section.

    After doing this, Laravel Debugbar will only be loaded in a local environment.