Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Web Profiler Bundle

Web Profiler Bundle Laravel Package

symfony/web-profiler-bundle

Symfony WebProfilerBundle integrates the Symfony Profiler into your app, showing debug and performance insights via the web debug toolbar and profiler pages. Inspect requests, routes, logs, DB queries, caching, events, and more to troubleshoot faster.

Deep Wiki
Context7

Symfony WebProfilerBundle provides the familiar Web Debug Toolbar and full Profiler UI for Symfony apps, helping you inspect requests, performance, and application behavior during development. It collects detailed runtime data and exposes it in an interactive interface, making it easier to diagnose issues and optimize your code.

Designed to integrate seamlessly with the Symfony ecosystem, it surfaces key insights per request while staying out of the way in production environments.

  • Web Debug Toolbar with at-a-glance metrics (time, memory, status)
  • Full Profiler panels for routing, DB queries, logs, events, cache, and more
  • Request/response inspection including headers, sessions, and cookies
  • Timeline and performance analysis to spot bottlenecks
  • Extensible collectors to add custom debugging data
Frequently asked questions about Web Profiler Bundle
Can I use Symfony WebProfilerBundle directly in a vanilla Laravel project without Symfony components?
No, the bundle is designed for Symfony and requires its HTTP Kernel and middleware stack. For vanilla Laravel, you’d need to either integrate Symfony’s components (like the HTTP Kernel) or build custom middleware to adapt Laravel’s data into Symfony’s Profiler format. Alternatives like Laravel Debugbar may be simpler for pure Laravel apps.
How do I disable the WebProfilerBundle in Laravel production to avoid performance overhead?
The bundle respects Symfony’s `APP_DEBUG` environment variable or Laravel’s `APP_DEBUG` config. Set `APP_DEBUG=false` in your `.env` file, and the Profiler will automatically disable itself. Additionally, ensure no middleware or routes expose the Profiler UI in production.
What Laravel versions are compatible with Symfony WebProfilerBundle?
The bundle itself doesn’t natively support Laravel, but if you’re using Symfony components (e.g., via Laravel Symfony Bridge), it works with Laravel 8.x, 9.x, and 10.x. For vanilla Laravel, compatibility depends on your custom middleware or integration approach, typically requiring Laravel 7.x or later for middleware flexibility.
How can I profile Laravel-specific data like query logs or job execution times in the Profiler?
You’ll need to create custom collectors that bridge Laravel’s debug data to Symfony’s Profiler format. This involves extending Symfony’s `DataCollector` class and injecting Laravel’s query log (via `DB::getQueryLog()`) or job events into the Profiler’s data structure. Documentation for custom collectors is available in Symfony’s ProfilerBundle docs.
Is there a way to use the Web Debug Toolbar without embedding Twig templates in Laravel?
Yes, you can render the toolbar using Blade templates by creating a custom Symfony-to-Blade bridge or embedding the toolbar in an iframe if running Symfony alongside Laravel. Alternatively, use Symfony’s standalone Profiler CLI tool (`php vendor/bin/profiler`) to analyze data without the UI.
What are the performance implications of using WebProfilerBundle in Laravel development?
The bundle adds minimal overhead during development, primarily from collecting and storing runtime data. In production, it’s disabled by default, but ensure no middleware or routes accidentally expose Profiler endpoints. Benchmark with `APP_DEBUG=true` to measure impact in your specific Laravel setup.
Are there alternatives to Symfony WebProfilerBundle for Laravel that offer similar debugging features?
Yes, consider Laravel Debugbar (for basic debugging), Tideways (advanced profiling with PHP extension), or Blackfire (deep performance analysis). These are Laravel-native and may require less integration effort. Compare features like query logging, event tracking, and timeline analysis to choose the best fit.
How do I secure the WebProfilerBundle’s toolbar to prevent unauthorized access?
Symfony’s Profiler uses a signed token for toolbar visibility. In Laravel, replicate this by generating a CSRF-protected token (e.g., via Laravel’s `csrf_token()` helper) and validating it in middleware. Ensure the token is bound to the `APP_DEBUG` environment and not exposed in production.
Can I use the Profiler to debug API requests in Laravel?
Yes, but you’ll need to ensure the Profiler middleware is registered for API routes. For Laravel, this typically involves adding the middleware to your `api.php` routes file or a dedicated middleware group. Note that API responses may need adjustments to include Profiler headers or data.
What’s the best way to test if the WebProfilerBundle is working correctly in a Laravel project?
Verify the toolbar appears at the bottom of the page in development mode (`APP_DEBUG=true`). Check if it displays metrics like execution time, memory usage, and route details. Test custom collectors by triggering specific Laravel events or queries and confirming their data appears in the Profiler panels. Use Symfony’s `profiler:dump` CLI command to export data for offline analysis.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport