Programming

How to Use Laravel Debugbar: Install, Setup and Fixes (v4)

On Laravel projects at Webzeto, the first sign of trouble is usually a page that "feels slow" with no error to chase. Laravel Debugbar is the tool we open first in those cases, because it shows every query, view and timing for the request right at the bottom of the page. Ten seconds with the Queries tab often explains what an hour of guessing could not.

Developer using Laravel Debugbar to inspect a slow page on a laptop.

There is a catch in 2026. The package changed owners and names in version 4, so many install commands floating around still point to the old package. If you copy them, you either get an outdated version or a Composer error. The steps below use the current package, explain each tab in plain words, and show how to keep the toolbar away from your live site.

Quick answer: To use Laravel Debugbar, run composer require fruitcake/laravel-debugbar --dev, set APP_DEBUG=true in your local .env file, and reload any page. The toolbar appears at the bottom. Use the Queries tab to spot slow or repeated queries, then fix them with eager loading. Never install or enable it on a public production site, because it can expose request data.

What Is Laravel Debugbar?

Laravel Debugbar is a free, open-source package that adds a debug toolbar to the bottom of your Laravel pages. It shows the database queries, views, route, timing, memory use, messages and exceptions for each request, so you can find slow code and bugs without adding dd() calls everywhere.

It wraps the PHP Debug Bar library and adds collectors built for Laravel. Collectors are small modules that gather one kind of data, such as queries or events. The package has over 5.6 million installs on Packagist under its new name (Packagist).

What Changed in Laravel Debugbar v4

Version 4 moved the package from barryvdh/laravel-debugbar to fruitcake/laravel-debugbar, and the PHP namespace is now Fruitcake\LaravelDebugbar. Laravel News reported the v4.0.0 release in January 2026 and listed these additions: an HTTP Client collector for outgoing requests, an Inertia collector, better Livewire support, Octane support, theme and position settings, and the removal of jQuery (Laravel News).

Later 4.x releases added an AI tab that turns on when the laravel/ai package is installed and a setting to capture streamed responses. Lumen support and socket storage were removed in v4.

How to Install Laravel Debugbar

Install Laravel Debugbar with Composer as a development dependency. Laravel’s package auto-discovery registers it for you, so there is no provider to add by hand. With APP_DEBUG=true in your local environment, the toolbar appears on the next page load.

If Composer is not set up yet, start with our guide to installing Composer for Laravel. For a fresh project, follow our walkthrough on how to install Laravel first.

Requirements

The current release, v4.4.4 from September 2026, requires PHP 8.2 or higher and supports Laravel 11, 12 and 13 (Packagist). If you are not sure which version your project runs, our guide to checking your Laravel version shows the command.

Step-by-Step Install

  1. Open a terminal in your project folder and run:
composer require fruitcake/laravel-debugbar --dev
  1. Check your local .env file:
APP_ENV=local
APP_DEBUG=true
  1. If you cached your config earlier, clear it so Laravel reads the new values:
php artisan config:clear
  1. Load any page that returns HTML. The toolbar appears at the bottom of the screen.
  2. Optional: publish the config file to change settings:
php artisan vendor:publish --provider="Fruitcake\LaravelDebugbar\ServiceProvider"

This creates config/debugbar.php, where you can switch collectors on or off (GitHub).

Upgrading From barryvdh/laravel-debugbar

The v4 upgrade is not a normal composer update, because the package name changed. Remove the old package, then require the new one:

composer remove barryvdh/laravel-debugbar --dev --no-scripts
composer require fruitcake/laravel-debugbar --dev --with-dependencies

Then search your code for Barryvdh\Debugbar and replace it with the new namespace. Compare your old config/debugbar.php with a freshly published copy, because v4 changed some defaults and removed old options. If you run Octane, remove the old Debugbar flush entry from config/octane.php.

Developer installing Laravel Debugbar as a dev dependency with Composer.

How to Enable or Disable Laravel Debugbar

Laravel Debugbar turns on automatically when APP_DEBUG is true and the environment is not production or testing. You can override that with DEBUGBAR_ENABLED in .env, with the enabled key in config/debugbar.php, or at runtime with Debugbar::enable() and Debugbar::disable().

The project’s README recommends keeping it disabled in config and enabling it only when needed, because collectors add overhead to every request (GitHub).

// .env on your local machine
DEBUGBAR_ENABLED=true

// Toggle it in code, for example in a local-only route
\Debugbar::enable();
\Debugbar::disable();

Skip Routes You Don’t Need

The config file has an except list. By default it ignores telescope* and horizon* routes. Add patterns such as api/* if you don’t want Debugbar data for those requests.

Turn Off Collectors That Slow You Down

If pages feel slower with Debugbar on, turn off the collectors you are not using. Several, such as Config, Files, Logs and Cache, are already off by default.

How to Use Laravel Debugbar Tabs

Each tab in Laravel Debugbar shows one kind of data for the current request. The Queries, Timeline, Views and Route tabs answer most “why is this page slow” questions. The Messages and Exceptions tabs help you trace logic without breaking the page with dd().

TabWhat it showsWhat to look for
MessagesValues you log with Debugbar::info() or debug()Variables at a point in your code
TimelineBoot time, app time and your custom timersThe step that takes the longest
ExceptionsExceptions caught and added to the barErrors you swallowed in a try block
ViewsBlade views rendered and, optionally, their dataToo many partials or heavy view data
RouteRoute name, URI, controller and middlewareThe wrong controller or extra middleware
QueriesEvery SQL query with bindings and timeRepeated queries and slow ones
EventsEvents fired during the requestListeners running more than once
RequestRequest and response detailsHeaders, session and input
MailMail sent during the requestMessages sent when they should not be
HTTP ClientOutgoing HTTP calls (v4)Slow third-party APIs

Find N+1 Queries With the Queries Tab

An N+1 problem happens when code runs one query for a list and then one more query for each item in it. In the Queries tab it shows up as the same select repeated many times with a different ID. Fix it with eager loading.

// Before: 1 query for the posts, plus 1 query per post
$posts = Post::all();

foreach ($posts as $post) {
    echo $post->user->name;
}

// After: 2 queries in total
$posts = Post::with('user')->get();

Reload the page and the repeated queries collapse into one. To catch new N+1 problems early, make lazy loading throw an error outside production in AppServiceProvider:

use Illuminate\Database\Eloquent\Model;

public function boot(): void
{
    Model::preventLazyLoading(! $this->app->isProduction());
}

On client projects, we run through the Queries tab on every list page before launch. Repeated queries on list pages are one of the most common speed problems we find.

Add Messages and Timers

Messages and timers let you see what your code is doing without stopping the request. They show up in the Messages and Timeline tabs (GitHub).

// Log values to the Messages tab
debugbar()->info($order);
debugbar()->warning('Stock is low');
debugbar()->addMessage('Coupon applied', 'checkout');

// Time a block of code
debugbar()->startMeasure('report', 'Build sales report');
// ... your code ...
debugbar()->stopMeasure('report');

// Or time a closure in one call
debugbar()->measure('Sync inventory', function () {
    // ... your code ...
});

// Quick helper that logs any values
debug($user, $cart);

The debugbar() and debug() helpers work without an import. If you prefer the Debugbar:: facade style, register the facade alias in the register method of AppServiceProvider first, as the install docs describe.

Track AJAX, Livewire and Inertia Requests

Debugbar shows redirects and AJAX and Livewire requests in a dropdown at the top of the bar, so you can switch between them. The v4 Inertia collector shows shared data and props. The Browse button opens earlier requests from storage, which is useful for API calls that return JSON instead of a page.

Laravel Debugbar Queries tab showing repeated N+1 queries on a list page.

Laravel Debugbar Not Showing? Fixes That Work

Laravel Debugbar usually stays hidden for one of five reasons: debug mode is off, the environment is production or testing, the config is cached, the response is not an HTML page, or the package was not installed on that machine. Check them in that order.

SymptomLikely causeFix
No bar on any pageAPP_DEBUG=false or APP_ENV=productionSet APP_DEBUG=true and APP_ENV=local in your local .env
You changed .env but nothing happenedConfig is cached, so .env is not readRun php artisan config:clear
Bar missing on one page onlyThe response has no </body> tag, or the route is in exceptReturn a full HTML layout, or remove the route pattern from except
Bar missing on API routesJSON responses have no page to inject intoUse the Browse button to open stored requests
Bar missing on a staging serverPackage installed with --dev but server ran composer install --no-devInstall dev packages on that server, or debug locally
Bar missing with catch-all routesYour route catches Debugbar’s asset routesLoad the Debugbar provider before your own providers

Laravel’s deployment docs explain the cached config case: once config is cached, the .env file is not loaded (Laravel docs).

Keep Laravel Debugbar Out of Production

Never run Laravel Debugbar on a public site. Its own README warns that it will leak information from stored requests by design. Laravel’s docs add that APP_DEBUG should always be false in production, because debug mode can expose sensitive configuration values to users.

A middleware toggle is not enough. The safer setup keeps the package off the server entirely:

  • Install it with --dev only, as shown above.
  • Deploy with composer install --no-dev, so the package is never on the live server.
  • Set APP_ENV=production and APP_DEBUG=false on the live server.
  • Don’t set DEBUGBAR_FORCE_ALLOW_ENABLE=true in production. It lets the provider boot there, and the README still advises against installing it on production at all.
  • Leave storage access limited. By default, the Browse feature only works from localhost and private networks such as Docker, Sail or a LAN. Anyone who can open it can read past requests.

If you deploy to shared hosting, our guide to deploying a Laravel project on cPanel shows where to set these values.

Laravel Debugbar vs Telescope vs Pulse

Debugbar shows data for the page you are looking at right now. Telescope records requests, jobs, mail and more into a dashboard you can browse later. Pulse gives a production-friendly overview of slow endpoints, jobs and active users. A common setup is Debugbar or Telescope locally and Pulse in production.

ToolWhere data appearsBest forProduction use
Laravel DebugbarToolbar on each pageFast checks while you build a pageNo
Laravel Telescope/telescope dashboardJobs, queues, mail and API requestsOnly with a locked access gate and pruning
Laravel PulsePulse dashboardSlow endpoints, slow jobs, active usersYes, it is built for it

Laravel describes Telescope as “a wonderful companion to your local Laravel development environment” and warns that it becomes public if APP_ENV is not set to production (Laravel docs). Pulse “delivers at-a-glance insights into your application’s performance and usage” (Laravel docs).

Our pick: install Debugbar first, because it needs no database tables and shows results on the page you are fixing. Add Telescope when you work with queues, scheduled tasks or APIs. Database tuning matters for other drivers too, as our guide on using MongoDB with Laravel shows.

If you need help with a slow Laravel app, our Laravel development team handles performance audits and fixes. Hiring in-house instead? Our list of skills every Laravel developer should have is a good checklist.

FAQ

Short answers to the questions developers ask most about Laravel Debugbar.

How do I install Laravel Debugbar?

Run composer require fruitcake/laravel-debugbar --dev in your project folder. Laravel registers it automatically. Make sure APP_DEBUG=true and APP_ENV=local in your .env file, run php artisan config:clear if you cached config, then reload an HTML page to see the toolbar.

Why is Laravel Debugbar not showing?

The most common causes are APP_DEBUG=false, an environment set to production or testing, or a cached config that ignores your .env changes. Run php artisan config:clear, check both values, and make sure the page returns full HTML with a closing </body> tag.

Is barryvdh/laravel-debugbar still maintained?

The package moved to fruitcake/laravel-debugbar in version 4. New releases ship under the new name. To upgrade, remove the old package with --no-scripts, require the new one with --with-dependencies, and update any references to the old namespace.

Does Laravel Debugbar work with Laravel 13?

Yes. The current 4.x release supports Laravel 11, 12 and 13 and requires PHP 8.2 or higher, according to its Packagist listing. Older Laravel versions need an older Debugbar release, so check the package requirements before you install.

Is it safe to use Laravel Debugbar in production?

No. The package warns that it leaks data from stored requests by design. Install it only as a dev dependency, deploy with composer install --no-dev, and keep APP_DEBUG=false on any public server.

How do I disable Laravel Debugbar?

Set DEBUGBAR_ENABLED=false in your .env file, or set APP_DEBUG=false. You can also call Debugbar::disable() in code. On a live server, the cleanest option is to not install the package at all.

Can Laravel Debugbar show API or AJAX requests?

Yes. AJAX and Livewire requests appear in a dropdown on the toolbar. For JSON API routes, which have no page to inject into, open the stored request through the Browse button. Storage access is limited to local and private networks by default.

What is the difference between Laravel Debugbar and Telescope?

Debugbar shows data for the current page in a toolbar. Telescope stores requests, jobs, mail, cache and more in a database and shows them in a dashboard. Use Debugbar for quick page checks and Telescope for background work and history.

Does Laravel Debugbar slow down my app?

Yes, a little, because it collects and renders data on every request. That is fine on your machine. If pages feel slow, turn off collectors you don’t need in config/debugbar.php, or keep it disabled and enable it only while you debug.

Conclusion

That page that “feels slow” usually has a clear cause once you can see it. Laravel Debugbar shows it: a query repeated fifty times, a view rendered twice, or a third-party API that takes two seconds to answer. Install the new fruitcake/laravel-debugbar package with --dev, read the Queries and Timeline tabs first, and fix N+1 problems with eager loading.

Keep the toolbar on your machine and off your servers. Deploy with composer install --no-dev, keep APP_DEBUG=false in production, and use Pulse when you need live performance data. Add Telescope when your app grows into queues and APIs.

Which page in your app would you open first with the Queries tab today?

Leave a Reply

Your email address will not be published. Required fields are marked *

Share the article

Written By

Author Avatar

October 28, 2026

Hi there! I’m Ayesha Khan, a skilled content writer with a strong background in computer science. I specialize in transforming complex ideas into clear, engaging, and easy-to-understand content. With 10 years of experience working across different industries, I focus on delivering content that not only informs but also connects with readers. I’m passionate about writing and take pride in creating high-quality work that helps clients communicate their message effectively.