85

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

10 Answers 10

155

Best option:

Add DEBUGBAR_ENABLED=false to your .env

This has some advantage:

  • The debugbar is totally disabled

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

  • It is not tracked by git

Sign up to request clarification or add additional context in comments.

1 Comment

Don't forget to run php artisan config:clear after changing the .env entry
111

Method 01: To completely turn off the debugger

In .env

APP_DEBUG=false # No error reporting at all

Method 02: Disable the debugger but still wants to receive Errors (**Recommended way)

In .env

DEBUGBAR_ENABLED=false # deguger is disabled, but error reporting works

Method 03: If ou want to remove *Debugbar completely

  1. composer remove barryvdh/laravel-debugbar
  2. then in config/app.php remove Barryvdh\Debugbar\ServiceProvider::class if exist and in the facade Barryvdh\Debugbar\ServiceProvider::class
  3. php artisan cache:clear

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


Useful Links

  1. Errors & Logging Laravel Docs 9.x
  2. Laravel Debugbar

4 Comments

I have never accepted before, I did not know that was a thing :).
@Ohgodwhy, I understand your point, and that is good advice, but development has been completed! I was just getting rid of that debugbar.
Why would you use APP_DEBUG=true in production? That makes literally no sense. You want big stack traces of your application printed when errors occur? I think you're wanting to target app_log_level instead.
Thanks, still works this way in Laravel 10 too.
32

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

1 Comment

In case you found error where Debugbar class in not found, make sure to import it as use Barryvdh\Debugbar\Facade as Debugbar;
29

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

3 Comments

Disabling from boot() in AppServiceProvider will be tracked by git. FYI
this is what i want DEBUGBAR_ENABLED env variable
I did it and now AppServiceProvier keep giving me error saying ''Barryvdh\Debugbar\ServiceProvider' not found. I Just removed, why still trying to find it?
10

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.

3 Comments

This seems like a permanent removal. I will keep this in mind for the future. I used Abdullas suggestion above because it was a bit faster :), Thank you for your advice and contribution.
The second one is much better if you don't want to use debugbar temporarily but enable the APP_DEBUG=true.
This would not work if there is a composer.lock file present because composer install will use this instead, and will have been generated from an previous version of composer.json. You need to run composer update instead, which will use your modified composer.json and generate the composer.lock based on that. The idea is you run update in development and deploy the lock file then only ever use install in production. This way you are guaranteed the same version as in testing right down to the minor version. Also you don't need to manually delete anything from vendor.
8

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,

1 Comment

This is great, but my question is why there is no debugbar.php in my config folder, is it something i have to add manually or is it supposed to be there since i'm using laravel 5.5 and have debugbar working in my sandbox server?
4

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!

Comments

1

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

Comments

1
  • If you want to remove the package, then do these steps:

$ composer remove barryvdh/laravel-debugbar
$ composer dump-autoload

Comments

-9

Also can be removed adding this to your .css file

.phpdebugbar{
    display: none;
}

3 Comments

That not a good idea. The data will still be sent to the user which means everybody who has a look at the HTML will also be able to see what is going on in your backend.
Thanks, never thought about that !
Of all the ways you could have accomplished this, this is the absolute worst. All you're doing is hiding the bar, not preventing it from loading, so you're getting all the disadvantage of the debugbar's slow speed with none of its debugging advantage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.