Weave 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
Command Bus Bundle

Command Bus Bundle Laravel Package

rezzza/command-bus-bundle

Symfony bundle that adds a command bus to your application, letting you dispatch commands to dedicated handlers with middleware support and service configuration. It helps separate request handling from business logic and supports a cleaner, CQRS-style architecture.

View on GitHub
Deep Wiki
Context7

rezzza/command-bus integration to Symfony

Frequently asked questions about Command Bus Bundle
What is rezzza/command-bus-bundle used for?
It is a Symfony bundle that adds a command bus to your application so commands are dispatched to dedicated handler classes instead of being processed inline in controllers. This keeps controllers and services thin while business logic lives in small, testable handler classes. It fits a CQRS-style architecture where each command has exactly one handler. Middleware lets you add cross-cutting behaviour such as logging, transaction handling, or event dispatch around every command.
How do I install rezzza/command-bus-bundle with Composer?
Install it with composer require rezzza/command-bus-bundle. If your Symfony application does not use Symfony Flex, register the bundle class in your config/bundles.php file. After that, the command bus service becomes available for injection and handlers registered as tagged services are wired automatically. Composer's dependency resolution will pull in the required bus library for you.
Does this package work with Laravel or is it Symfony only?
It is built as a Symfony bundle and relies on Symfony's dependency injection container, service tags, and autoconfiguration, so it is not a Laravel package. In Laravel you would normally use the framework's own bus or queue dispatching instead. Composer will install it, but the integration targets Symfony applications specifically.
How do I register a command handler with the bus?
You create a handler class that handles a specific command type and register it as a service tagged for the command bus. With autoconfiguration enabled, the tag is applied for you, so most handlers need no manual container configuration. The bundle then routes each dispatched command to the handler registered for that command class.
How do I dispatch a command from a controller?
Inject the command bus service into your controller or any other service and call its dispatch method with the command object. The controller stays thin because it only builds the command and hands it off; all business logic stays in the handler. This also makes the controller easy to unit test with a mocked bus.
How does middleware work in the command bus?
Middleware wraps command execution, so it runs before and after the handler, letting you add concerns like logging, validation, or wrapping the handler in a database transaction. You register middleware as services and configure them so the bus executes them in order around the handler. This keeps cross-cutting logic out of individual handlers and reusable across commands.
Which Symfony versions does this bundle support?
Support depends on the version constraints declared in the package's composer.json, so check the require section and the tagged releases before upgrading. The bundle depends on Symfony's DI component and on a separate command bus library, and both constraints affect compatibility. For older or very new Symfony releases, verify the constraint range rather than assuming support.
How do I test commands and handlers with this bundle?
Because handlers are plain services, you can instantiate them directly in a unit test and assert the result without booting the bus. For integration tests, dispatch through the bus service from the test container to verify routing and middleware behaviour. Mocking the bus interface is also a simple way to assert a controller dispatched the expected command.
Is this bundle suitable for production use?
It is a small integration layer over a command bus library, so the main production considerations are the stability of that underlying library and the maintenance activity of the bundle itself. Check the latest release date, open issues, and whether the Symfony version you run is still covered by the constraints. If the project is no longer maintained, Symfony Messenger is the native alternative to evaluate.
What are the alternatives to rezzza/command-bus-bundle?
The most common alternative in modern Symfony applications is Symfony Messenger with its synchronous message bus, which offers handlers, middleware, and optional async transports out of the box. Older projects often used the Tactician library with its Symfony bridge. This bundle remains a lightweight option when you only want simple command-to-handler routing with middleware and no transport layer.
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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle