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

Symfony Bridge Laravel Package

simple-bus/symfony-bridge

Symfony integration bridge for SimpleBus/MessageBus. Provides CommandBusBundle, EventBusBundle, and DoctrineORMBridgeBundle to wire command and event buses into your Symfony app, with docs and upgrade guide.

View on GitHub
Deep Wiki
Context7

[READ ONLY] Bridge for using command buses and event buses in Symfony projects. Full documentation can be found here:

Frequently asked questions about Symfony Bridge
Can I use this package in Laravel for CQRS without Symfony dependencies?
Yes, but with abstraction. The Symfony bundles (CommandBusBundle, EventBusBundle) require Symfony’s ContainerInterface and kernel events. Wrap SimpleBus’s core in a Laravel facade (e.g., `app(CommandBus::class)`) and inject handlers via Laravel’s service container. Avoid Symfony-specific features like bundles to minimize overhead.
How does this compare to Laravel’s built-in queues or Bus package?
SimpleBus excels for cross-service messaging, explicit command/event separation, and middleware pipelines. Laravel’s queues are simpler for background jobs but lack CQRS’s command/event distinction. Use SimpleBus if you need decoupled services (e.g., microservices) or event sourcing; otherwise, Laravel’s Bus or queues suffice.
Will this work with Laravel 10+ and PHP 8.2?
The package supports PHP 7.4+, but Symfony-specific components may conflict with Laravel’s newer versions. Test thoroughly, especially if using DoctrineORMBridgeBundle. For Laravel 10+, abstract Symfony dependencies (e.g., replace `ContainerInterface` with Laravel’s `Container`) or fork the package.
How do I integrate the EventBus with Laravel’s event system?
Use Laravel’s `Event::dispatch()` to publish events, then configure SimpleBus’s EventBus to listen via queued handlers. Map Symfony’s event listeners to Laravel’s `listen()` method in `EventServiceProvider`. For async processing, dispatch events to queues and let SimpleBus handle them.
Is DoctrineORMBridgeBundle useful in Laravel, or should I avoid it?
Avoid the full Doctrine ORM bundle if using Eloquent. Instead, use `doctrine/dbal` for lightweight event storage or adapt SimpleBus’s event persistence logic to Eloquent observers. The bundle’s main value (event replayability) can be replicated with Laravel’s database logging or custom event tables.
How do I test message handlers in Laravel with this package?
Mock SimpleBus handlers using PHPUnit’s `createMock()` or Laravel’s `Mockery`. For command buses, inject mock handlers into the container. For events, use Laravel’s `fake()` to assert event dispatches. Test middleware by mocking SimpleBus’s `MiddlewareStack` and verifying invocations.
Can I use this for real-time event processing (e.g., WebSockets)?
Yes, but configure SimpleBus’s EventBus to publish events to a queue (e.g., Redis) and process them asynchronously. For WebSockets, dispatch events to a queue, then broadcast them via Laravel Echo or Pusher. Avoid blocking the event bus with synchronous WebSocket logic.
What’s the best way to handle middleware (e.g., logging, validation) in Laravel?
Map SimpleBus middleware to Laravel’s queue middleware or event listeners. For example, wrap a logging middleware in a Laravel queue job middleware. Use Laravel’s `app()->make(Middleware::class)` to instantiate SimpleBus middleware if needed, but prefer Laravel-native solutions for simplicity.
Are there alternatives to this package for Laravel?
Yes: Laravel Bus (for command buses), Symfony Messenger (if using Symfony), or custom implementations with PHP’s `SplQueue` or libraries like `league/event`. For event sourcing, consider `spatie/laravel-event-sourcing`. Evaluate based on needs—SimpleBus shines for CQRS/DDD but requires more setup in Laravel.
How do I upgrade from an older version of this package?
Follow the [upgrade guide](http://simplebus.github.io/SymfonyBridge/doc/upgrade_guide.html) for Symfony-specific changes. In Laravel, focus on container binding updates (e.g., `bind(CommandBus::class, fn() => new CommandBus(...))`). Test thoroughly, as Laravel’s DI system differs from Symfony’s.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky