fruitcake/laravel-debugbar
Integrate PHP DebugBar into Laravel to inspect requests in real time. Track queries, time, memory, routes, views, events, logs, and exceptions with an in-browser toolbar. Configurable collectors, storage, and easy setup for local development and debugging.
DebugbarServiceProvider auto-registers middleware and facade, reducing integration risk.DebugbarMiddleware into Laravel’s pipeline, ensuring request-scoped debugging without manual instrumentation. This is ideal for TPMs managing monolithic Laravel apps where global observability is needed.config/debugbar.php, enabling environment-specific setups (e.g., disable in production, enable in staging with query limits).debugbar.storage.open, but warns against enabling in shared environments. TPMs must designate this for local/dev only to avoid security risks.db collector with backtrace and with_params can slow down requests (mitigated by soft_limit/hard_limit).files or models may bloat memory usage in long-running requests (e.g., CLI jobs). TPMs should disable unnecessary collectors in CI or batch environments.debugbar()->disable() in performance-critical paths (e.g., APIs) or leverage runtime toggling via middleware.debugbar.storage.open in shared/staging exposes sensitive request data (e.g., session, logs) to other users.open callback or use environment-based config (e.g., app()->environment('local')).rcrowe/TwigBridge (v0.6.x), adding a minor dependency if the app uses Twig.debugbar.collect_jobs may block job processing if jobs are heavy or numerous.hard_limit) in staging.local, staging, and production? (e.g., IP-restricted storage, collector whitelists).soft_limit, hard_limit) should we enforce in staging to balance debugging and performance?debug(), measure(), custom collectors)?collect_jobs is enabled), though job collection adds overhead.composer.json:
composer require fruitcake/laravel-debugbar --dev
php artisan vendor:publish --provider="Fruitcake\LaravelDebugbar\ServiceProvider" --tag="config"
app/Http/Kernel.php (auto-injected by default in Laravel 8+):
\Fruitcake\LaravelDebugbar\Middleware\Debugbar::class,
config/debugbar.php to enable/disable collectors and set environment-specific options (e.g., query limits).'collectors' => [
'db' => true,
'queries' => [
'soft_limit' => 50,
'hard_limit' => 200,
],
],
// In AppServiceProvider boot()
if (!app()->environment('local', 'staging')) {
\Debugbar::disable();
}
config/debugbar.php:
'storage' => [
'open' => app()->environment('local') ? true : false,
],
config/twig.php (if using TwigBridge):
'extensions' => [
Fruitcake\LaravelDebugbar\Twig\Extension\Debug::class,
Fruitcake\LaravelDebugbar\Twig\Extension\Dump::class,
],
mysql, pgsql). Non-PDO drivers (e.g., mongodb) won’t show queries.laravel/livewire).collect_jobs: false in production.files (high overhead) and jobs (unless debugging queues).debug(), query backtraces, timing).soft_limit=50, hard_limit=200).How can I help you explore Laravel packages today?