How to safely remove Laravel Debugbar

How to safely remove Laravel Debugbar

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Identifying and Removing the Laravel Debugbar

That bar you are seeing at the bottom of your pages is almost certainly the Laravel Debugbar (formerly known as Barryvdh/Debugbar). It is a widely adopted package designed to provide developers with quick access to query times, memory usage, exception traces, and environment details. While invaluable during development, leaving it enabled in a production environment introduces unnecessary overhead and exposes internal application logic to end users.

The default configuration for this package registers itself as an event listener on app.booted. This means the middleware or service provider hooks into the application lifecycle every time a request enters your system. The performance cost is negligible for simple queries but can become significant for high-traffic applications with complex database operations, as the Debugbar gathers data and renders HTML after every route execution.

Verifying the Installation

Before attempting deletion, you need to confirm whether the package is explicitly installed or if it was added via a service provider that might be autoloaded elsewhere. Run the following command in your terminal:

composer show | grep debugbar

If this returns output like barryvdh/laravel-debugbar, the package is installed in your vendor directory. You can also check your composer.json file under the require section to see if it is listed explicitly.

However, installation isn't the only factor. The Debugbar is controlled by an environment variable. Even if the package is installed, it will not render its UI unless specific conditions are met. Check your .env file for the following lines:

DEBUGBAR_ENABLED=true
DEBUGBAR_DRIVER=file

If DEBUGBAR_ENABLED is set to true, the system attempts to load the driver. In production environments, the default driver is often file, which writes data to storage/logs/debugbar-*.json. You will likely find files in your storage/logs folder if this has been active recently.

The Safe Removal Process

Removing the Debugbar requires two steps: clearing the output artifacts and disabling the package logic.

First, clear the accumulated log data generated by the file driver. Navigate to your project's storage/logs directory and delete any files matching the pattern debugbar-*.json. While these files are not critical for application functionality, they can grow large over time if left unmanaged.

Next, disable the package in your .env file. Set the environment variable to false:

DEBUGBAR_ENABLED=false

This single line is often sufficient. The Debugbar package respects this variable and will skip rendering the UI and gathering data entirely when it is set to false. This approach allows you to keep the Composer dependency installed for potential future use during development phases without paying the runtime cost in production.

If you wish to remove the dependency completely, run:

composer remove barryvdh/laravel-debugbar

After running this command, ensure you clear your application cache to prevent any lingering service provider registrations from affecting the build:

php artisan config:clear
php artisan cache:clear
php artisan view:clear

Configuring for Production

The most robust solution is to combine environment-specific configuration with a custom middleware or service provider logic. Many production deployments use APP_ENV=production to automatically toggle features. You can create a dedicated .env.production file that overrides the default settings, ensuring your developers don't accidentally enable debugging tools in live environments.

Additionally, check your config/app.php file. While the Debugbar package usually handles its own service provider registration, inspecting the providers array ensures no other packages are inadvertently pulling in similar debugging logic.

One common pitfall is assuming that removing the UI removes all functionality. Some developers use the Debugbar to collect metrics programmatically. If you rely on those specific metrics without the UI, disabling the UI alone might not be enough; you may need to adjust the driver configuration or switch to a more lightweight logging strategy like Laravel Telescope for production monitoring, which offers similar insights but is designed with performance and security in mind.

By verifying the installation, clearing existing logs, and toggling the DEBUGBAR_ENABLED flag, you effectively neutralize the tool without risking application stability. Always test your changes on a staging environment before deploying to live production servers.

Our network