How to safely remove Laravel Debugbar
PhpLaravelLaravel 5Php Problem Overview
I have a Laravel application that was not developed by me. There is some weird bar at the bottom of each page, it is some type of Laravel debugger tool.
I believe it is stored in storage/debugger. Is there a safe way I can go about checking to see if this is actually it and if so can I delete this type of tool without it affecting the application? Does anybody know what this thing is if so any advice on how to remove this safely would be greatly appreciated
Php Solutions
Solution 1 - Php
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
Solution 2 - Php
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
Solution 3 - Php
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
- 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(); } }
Solution 4 - Php
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
Solution 5 - Php
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
.
Solution 6 - Php
I am using this way:
In config/debugbar.php
'inject' => false, // this remove Inject Debugbar in Response
In this way I am keeping .php error enable.
Another way is to disable completely.
'enabled' => false,
To enable just debug-bar and disable it for session and Ajax request
'enabled' => true,
....
'storage' => [
'enabled' => false, // DebugBar stores data for session/ajax requests.
or
'capture_ajax' => false,
Solution 7 - Php
I removed barryvdh/laravel-debugbar
from my composer.json
.
When I wanted to do composer install
or composer update
or even php artisan config:cache
I got error
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Barryvdh\Debugbar\ServiceProvider' not found
If fact the solution was removing boostrap/cache/config.php
, because barryvdh/laravel-debugbar
was cached (php artisan config:cache
could not remove it)
Good luck!
Solution 8 - Php
It needs to be also removed in the providers: app/config/app.php
After:
composer remove vendor/barryvdh/laravel-debugbar
composer update
remove the line:
Barryvdh\Debugbar\ServiceProvider
in app/config/app.php.
Also these folders can be deleted:
app/config/packages/barryvdh/laravel-debugbar/config.php
- another Debugbar-related file somewhere under
app/storage/...
Solution 9 - Php
Also can be removed adding this to your .css file
.phpdebugbar{
display: none;
}