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

Symfony Bridge Laravel Package

php-debugbar/symfony-bridge

Symfony bridge for PHP Debug Bar. Install via Composer to integrate php-debugbar into Symfony apps, with a ready-to-run demo and PHPUnit test suite (including Panther browser tests) for verifying integration and UI behavior.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing the base php-debugbar/php-debugbar package (required), then add this bridge:

composer require php-debugbar/php-debugbar php-debugbar/symfony-bridge

Once installed, the bridge automatically registers the PHP Debugbar collector and provider with Symfony’s Service Container — no manual configuration needed for basic usage. The first thing developers will notice is the Debugbar panel appearing in Symfony’s Profiler (if enabled), showing request data, logs, timeline, and more — now integrated via Symfony’s event listener infrastructure.

For immediate exploration, run the included demo:

composer install
composer run demo
# Visit http://localhost:8000/demo/

Implementation Patterns

  • Automatic Integration: As a bridge, this package just works out of the box — no service definitions required. It hooks into Symfony’s kernel lifecycle to collect performance metrics, logs, exceptions, and request/response data.
  • Laravel-Like Experience in Symfony: Developers migrating from Laravel will recognize the familiar debugbar() helper (if facade is enabled) and Debugbar::info() usage — the bridge reuses the same API as the core PHP Debugbar package.
  • Custom Collectors: To add app-specific data (e.g., doctrine query counts, cache stats), register custom collectors as services tagged with php_debugbar.collector. Example:
    // config/services.yaml
    services:
      App\DebugBar\QueryCollector:
        tags: [ { name: php_debugbar.collector, alias: 'queries' } ]
    
  • Conditional Activation: Use Symfony’s environment-based configuration (e.g., when@dev) to only enable the debugbar in non-production:
    when@dev:
      php_debugbar:
        enabled: true
    

Gotchas and Tips

  • No standalone config: Despite Symfony conventions, this package does not ship with a config/debugbar.php. Configuration is handled entirely by the core php-debugbar/php-debugbar package (see its docs).
  • Resettable Services: Since v1.1.0, collectors can implement ResettableInterface for proper reset between requests in long-running processes (e.g., workers via Symfony Messenger). Ensure custom collectors implement this if state persists across requests.
  • Kernel Event Conflicts: If your app uses custom event subscribers on KernelEvents::RESPONSE, ensure they run after debugbar’s collector (priority -1000 or lower). Misordered events may result in missing data (e.g., late exceptions).
  • Version Alignment: The bridge is tightly coupled to php-debugbar/php-debugbar — always match versions (e.g., ^1.0 bridge ↔ ^3.0 core). Check composer.lock for compatibility.
  • Missing Profiler Data? → Clear cache (bin/console cache:clear) and verify the PhpDebugBar\SymfonyBridge\DataCollector\HttpCollector is registered (it should appear in bin/console debug:container --tag=php_debugbar.collector).
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
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
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation
uri-template/tests