Cut PHP Code Review Time & Bugs into Half with CodeRabbit

Laravel Debugbar

barryvdh/laravel-debugbar image

Laravel Debugbar stats

Downloads
64M
Stars
15,580
Open Issues
100
Forks
1,548

View on GitHub →

PHP Debugbar integration for Laravel

Barryvdh Laravel Debugbar Package Summary

The Barryvdh Laravel Debugbar package integrates PHP Debug Bar with Laravel, providing a powerful and flexible way to add debugging capabilities directly into your Laravel applications. Ideal for development environments, this tool helps you monitor various aspects of your application without affecting production performance.

Key Features

  • Multiple Data Collectors: Includes collectors for queries, routes, views, events, Laravel environment, request/response data, and more.
  • Integration with Laravel: Seamlessly integrates with Laravel's service provider and uses facades for easier logging and message handling.
  • Customizable: Enable or disable individual collectors, manage vendor files inclusion, and configure through Laravel's environment settings or directly in the config file.
  • Runtime Control: Easily enable or disable the Debugbar during runtime via simple method calls.
  • Storage and History: Stores data from requests for later analysis, accessible through a browser interface.
  • Twig Support: Includes extensions for Twig to use Debugbar functions within templates.

Installation

Install via composer for development environments only to prevent potential data leakage and performance hits in production:

composer require barryvdh/laravel-debugbar --dev

Laravel's package auto-discovery handles the service provider linking. After installation, publish configuration and assets using:

php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"

For non-auto-discovery setups, manually add the service provider and facade in your config/app.php.

Configuration

  • Enable or disable Debugbar in your .env file using DEBUGBAR_ENABLED or directly in the config/debugbar.php.
  • Customize data collectors, manage asset loading, and configure storage options through the published configuration file.

Usage

Utilize the Debugbar for logging, timing, and error handling:

Debugbar::info($object);
Debugbar::error('Error!');
Debugbar::startMeasure('render', 'Time for rendering');
Debugbar::stopMeasure('render');

Debugbar supports conditional enabling/disabling, which can be adjusted during runtime:

\Debugbar::enable();
\Debugbar::disable();

Security Note

Only use Debugbar in development environments or securely restricted areas of staging environments. Ensure it is disabled in production to prevent performance degradation and information exposure.

Additional Integration

For Lumen or Laravel Octane, specific configuration steps are required, detailed in the package documentation. Debugbar also supports integration with Twig through additional extensions, enhancing debugging capabilities within Twig templates.

In summary, the Laravel Debugbar by Barryvdh is an essential tool for developers looking to streamline their debugging processes efficiently, offering extensive customization and integration options tailored for Laravel applications.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Barryvdh Laravel Debugbar Related Articles

Laravel Debugbar Gets a Big UI Update image

Laravel Debugbar Gets a Big UI Update

Read article
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $3200/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy