termyn/cqrs
A lightweight CQRS package for Laravel that separates writes from reads. Route commands and queries through dedicated buses to single-purpose handlers, keeping controllers thin and application logic organized, testable, and easy to extend.
dispatch(new Job) and event(), this package is a concrete, thin option to prototype against. It provides commands, handlers, and a middleware pipeline without dragging in event sourcing.Command → Handler pairs make bounded contexts legible in the codebase. This supports a decision to stay one deployable but enforce seams between domains — the cheap step before any service extraction.ApproveRefund) rather than table rows. That supports future decisions on audit logging, replay, and compliance reporting.Consider it when:
Look elsewhere when:
To executives: This is a small, MIT-licensed library that adds a structured command layer to our PHP backend. It is not a platform bet — it is a pattern enabler. The business case is maintainability and delivery speed in the complex parts of the product: write logic becomes named, testable, and auditable ("ApproveRefund" instead of scattered controller code), which shortens onboarding and reduces regression risk on our highest-churn features. The cost is low and reversible, but the adoption signal is genuinely weak — no community, no dependents — so the recommendation is a two-week spike on one bounded context, behind our own interface, with a documented exit path. Approve the spike, not a standard.
To engineering: Treat it as a reference architecture and a thin command/handler dispatcher over Symfony Messenger. Concrete asks: (1) verify Messenger version compatibility with our PHP/Laravel baseline — the 4.3+ claim is dated; (2) wrap the dispatcher behind an internal CommandBus interface so we can swap to Laravel's bus or Ecotone without touching call sites; (3) define our middleware set up front — transaction, validation, logging, authorization — since that is where the value and the complexity both live; (4) agree explicitly that we are doing CQRS, not event sourcing: no event store, no replay. If the spike shows no measurable win over dispatch() plus Jobs, we keep the pattern and drop the package.
How can I help you explore Laravel packages today?