How to safely remove Laravel Debugbar

PhpLaravelLaravel 5

Php 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.

enter image description here

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

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

Solution 3 - Php

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();
         }
     }
    

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:

  1. composer remove vendor/barryvdh/laravel-debugbar
  2. 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;
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser9006369View Question on Stackoverflow
Solution 1 - PhpArnSoosView Answer on Stackoverflow
Solution 2 - PhpAbdulla NilamView Answer on Stackoverflow
Solution 3 - PhpYvesView Answer on Stackoverflow
Solution 4 - PhpGooglianView Answer on Stackoverflow
Solution 5 - PhpOhgodwhyView Answer on Stackoverflow
Solution 6 - PhpFlorinView Answer on Stackoverflow
Solution 7 - PhpAdam KozlowskiView Answer on Stackoverflow
Solution 8 - PhpbastiotutuamaView Answer on Stackoverflow
Solution 9 - PhpFer ToastedView Answer on Stackoverflow