How to safely remove Laravel Debugbar
Remove Laravel Debugbar
- If you want to totally remove the package, then do these steps:
$ composer remove vendor/barryvdh/laravel-debugbar
$ composer update
Disable Laravel Debugbar
Option 1: Via Env File
- If you want disable the package, without it getting tracked by Git:
- Navigate to your
.env
file - And put
DEBUGBAR_ENABLED = FALSE
Option 2: Via AppServiceProvider
- From @Ohgodwhy's answer
- FYI: This will be tracked by Git. - @Salam
- Navigate to
app/Providers/AppServiceProvider.php
Put this code
\Debugbar::disable();
class AppServiceProvider extends ServiceProvider { public function boot() { \Debugbar::disable(); } }
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 developmentIt is not tracked by git
To completely disable the debugger
In .env
APP_DEBUG=false # No error reporting at all
Disable the debugger but still wants to receive Errors (**Recommended way)
In .env
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 usingphp artisan config:clear
orphp artisan optimize:clear
Useful Links
- Errors & Logging Laravel Docs 9.x
- Laravel Debugbar
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