fruitcake/laravel-debugbar
Integrate PHP Debug Bar into Laravel to inspect requests in real time. Shows executed queries, routes, views, logs, cache/events, and timing/memory metrics with an in-browser toolbar and detailed panels. Great for profiling and debugging during development.
Pros:
collect_jobs for performance-sensitive apps).APP_DEBUG, middleware) without modifying core logic. Ideal for monolithic or modular Laravel apps.Cons:
APP_DEBUG=true limits production use. Requires runtime toggling or config overrides for conditional enablement (e.g., staging environments).Laravel Compatibility:
debugbar.middleware) for request/response interception. Low risk of conflicts with existing middleware.illuminate.query, illuminate.log) without requiring event listener registration.Third-Party Dependencies:
maximebf/debugbar (PHP DebugBar), a mature, widely used package with 10K+ stars. Minimal risk of breaking changes.rcrowe/TwigBridge (if using Twig).Testing:
Debugbar facade). Integration tests should verify middleware and storage behavior.APP_DEBUG) can gate CI execution.Performance Impact:
collect_jobs).hide_empty_tabs to reduce UI clutter.APP_DEBUG=false in production and use IP-based storage access controls.Storage Risks:
storage/debugbar) may arise in shared hosting. Use storage:link or explicit permissions.Edge Cases:
capture_ajax carefully.Debugging Workflow:
Environment Strategy:
storage/debugbar)?Performance:
CI/CD:
APP_DEBUG be managed?Long-Term Maintenance:
config/debugbar.php)?Laravel Ecosystem:
Non-Laravel Stacks:
maximebf/debugbar) is Symfony-compatible. Laravel-specific features (e.g., Eloquent collectors) won’t work.capture_ajax for SPAs).Installation:
composer.json with --dev:
composer require fruitcake/laravel-debugbar --dev
php artisan vendor:publish --provider="Fruitcake\LaravelDebugbar\ServiceProvider"
.env (optional):
APP_DEBUG=true
DEBUGBAR_EDITOR=phpstorm
DEBUGBAR_COLLECT_JOBS=false
Configuration:
APP_DEBUG=true in .env. No further action needed.'storage' => ['enabled' => env('APP_DEBUG')],
'except' => ['api/*'],
'collectors' => ['queries', 'events', 'logs'],
Testing:
Debugbar facade to test collector logic.public function test_debugbar_middleware()
{
$response = $this->get('/');
$response->assertSee('Debugbar'); // Check UI
}
Laravel Versions:
| Version | Compatibility | Notes |
|---|---|---|
| Laravel 10+ | ✅ Full | Auto-discovery, Octane support. |
| Laravel 9 | ✅ Full | Manual SP registration if needed. |
| Laravel 8 | ✅ Full | Tested; no breaking changes. |
| Laravel 7 | ⚠️ Partial | May need legacy config adjustments. |
| Lumen | ❌ Deprecated | Not supported. |
PHP Versions:
Database Drivers:
Phase 1: Core Integration (1–2 days):
.env and config/debugbar.php settings.Phase 2: Customization (1–3 days):
Phase 3: Advanced Use (Ongoing):
How can I help you explore Laravel packages today?