Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to safely remove Laravel Debugbar

Best option:

Add DEBUGBAR_ENABLED=false to your .env

This has some advantages over Abdulla Nilam's answer:

  • Debugbar is totally disabled

  • You can keep APP_DEBUG=true, hence still keep error details for local development

  • It is not tracked by git


Navigate to .env and use these commands

APP_DEBUG=false # No error reporting at all

or

DEBUGBAR_ENABLED=false # deguger is disabled but error reporting works

FYI: Once you changed the values on .env and it didn't reflex, clear the config using php artisan config:clear or php artisan optimize:clear


Useful Links

  1. Errors & Logging Laravel Doc's
  2. Laravel Debugbar

Remove Laravel Debugbar

- If you want to totally remove the package, then do these steps:

  1. $ composer remove vendor/barryvdh/laravel-debugbar
  2. $ composer update

Disable Laravel Debugbar


Option 1: Via Env File

- If you want disable the package, without it getting tracked by Git:

  1. Navigate to your .env file
  2. And put DEBUGBAR_ENABLED = FALSE


Option 2: Via AppServiceProvider

- From @Ohgodwhy's answer

- FYI: This will be tracked by Git. - @Salam

  1. Navigate to app/Providers/AppServiceProvider.php
  2. Put this code \Debugbar::disable();

    class AppServiceProvider extends ServiceProvider
    {
        public function boot()
        {
            \Debugbar::disable();
        }
    }
    

Enabling/Disabling on run time.

You can enable or disable the debugbar during run time.

Add this into your .env file:

DEBUGBAR_ENABLED = FALSE

In runtime:

\Debugbar::enable();
\Debugbar::disable();

Or remove everything

composer remove barryvdh/laravel-debugbar


You can execute composer remove barryvdh/laravel-debugbar to permanently remove it.

Note you can also just disable the debug bar if you don't want it:

Just put \Debugbar::disable(); in your AppServiceProvider.