Download the PHP package talred/cqrs without Composer
On this page you can find all versions of the php package talred/cqrs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package cqrs
Short Description CQRS application layer for PHP 8.2+ with command/query buses, decorator-based middleware pipeline, Result/Option monads, repository abstractions with caching, transaction management, domain event dispatching, and automatic handler discovery via attributes.
License MIT
Informations about the package cqrs
Talred CQRS
CQRS that fits in your stack, not the other way around.
A complete application layer for PHP 8.2+: command/query buses with a decorator pipeline, Result/Option monads for predictable error handling, transactional orchestration with automatic event dispatching, repository abstractions with caching, and automatic handler discovery via PHP 8 attributes. No event sourcing required — but nothing stopping you if you want it.
Why Talred CQRS?
The problem
Laravel gives you Eloquent, queues, and events — excellent infrastructure. But the application architecture layer between "HTTP request" and "database query" is left as a DIY exercise. Most teams end up with fat controllers, service classes that mix concerns, and event handling scattered across listeners. Testing is painful because business logic is tangled with framework code.
What Talred CQRS does differently
| Approach | How it works | Trade-off |
|---|---|---|
| Ecotone | Full messaging framework with aggregates, projections, sagas | Heavyweight, steep learning curve, all-or-nothing |
| Broadway | Event sourcing toolkit | Requires event sourcing commitment |
| Spatie Event Sourcing | Laravel event sourcing | Event-sourcing only, no command/query separation |
| Tactician | Simple command bus | Command-only, no queries, no Result monads, no orchestration |
| Talred CQRS | Decorator-based buses + monads + Application Service orchestration | Pragmatic CQRS without event sourcing tax |
Talred CQRS occupies a pragmatic middle ground: you get clean command/query separation, type-safe results, automatic event dispatching, and transactional orchestration — without being forced into full event sourcing. Use as much or as little as your project needs.
Who is this for?
- Teams who want command/query separation without rewriting their entire architecture
- Projects that need multi-step transactional workflows (registration, checkout, onboarding) with automatic rollback
- Developers who want predictable error handling without try/catch pyramids
- Applications that will eventually need event sourcing or queued commands, but not today
Install
Laravel auto-discovers the service provider. No manual registration needed.
Publish configuration
This creates config/talred.php. New applications should put CQRS settings below the cqrs key:
Existing top-level settings such as zolta.commands and zolta.cache remain supported during migration. New configuration should use talred.cqrs.*; resolved values are mirrored to zolta.cqrs.* and the legacy aliases. The original zolta-cqrs-config tag and config/zolta.php file remain available.
Namespace compatibility
talred/cqrs exposes the public Talred\Cqrs\... namespaces while keeping
the existing Zolta\Cqrs\... implementation and imports intact. New
applications and examples should use Talred\Cqrs\...; existing applications
can continue using Zolta\Cqrs\... during the staged migration. The Talred
publish tag and config/talred.php file are the preferred public
configuration surface. Technical runtime identifiers such as
zolta-cqrs-config, config/zolta.php, and zolta.* configuration keys
remain stable.
Quick Start
1. Define a command
2. Create a handler
3. Add validation (optional)
4. Dispatch
5. Query data
6. Orchestrate with ApplicationService
Architecture
The command bus decorator chain
Commands flow through a composable decorator pipeline — each layer adds one concern:
Every decorator is optional. Need just sync dispatch? Use SynchronousCommandBus directly. Need validation without events? Stack only what you need. The WorkerAwareRoutingCommandBus detects worker context to prevent re-enqueue loops automatically.
Result & Option monads
Commands return Result, queries return Option — no more guessing what a method returns:
No more returning null | array | false | throw from service methods. The type tells you what happened.
ApplicationService orchestration
Multi-command workflows with automatic transactions, result capturing, and response mapping:
Repository framework
Framework-agnostic repositories with 12 filter operators, relation loading, pagination, sorting, field selection, and namespace-scoped caching:
Mandatory constraints are created by application or infrastructure code, applied with
AND semantics before optional filters, and included in repository cache keys. Raw
constraint arrays are rejected, undeclared constraint fields fail closed, and a client
filter cannot replace a constrained field. Do not construct constraints from HTTP input.
Cache layer uses tagged keys with configurable TTL — RepositoryCache interface with Laravel, APCu, or null implementations.
Message hydration
Automatic construction of Commands, Queries, and Value Objects from raw arrays — no manual new calls:
Performance
Benchmarked on a real application (Laravel 12, PHP 8.3, SQLite):
| Component | Time (warm) |
|---|---|
| CommandBus dispatch overhead | < 1ms |
| QueryBus ask overhead | < 1ms |
| ApplicationService wrapping | < 2ms |
| Message hydration (cached class) | < 0.6ms |
| Event dispatching | < 1ms |
| Total CQRS overhead per request | < 5ms |
The dominant costs in any request are your application logic — database queries, bcrypt hashing, external API calls. The CQRS layer stays invisible.
Features at a glance
| Feature | Details |
|---|---|
| Command bus | 5-layer decorator chain: sync → validating → event-dispatching → queued → worker-aware |
| Query bus | In-memory with automatic handler resolution and dependency injection |
| Result monad | success(value, events) / failure(error, events) with event accumulation |
| Option monad | some(values) / none() / error(throwable) — null-safe queries |
| ApplicationService | Transactional orchestration, capture store, placeholder resolution, response mapping |
| Handler discovery | #[HandlesCommand] · #[HandlesQuery] · #[ValidatesCommand] · #[HandlesDomainEvent] |
| Argument resolution | Container injection + command/query type matching + variadic support |
| Message hydration | Reflection-cached construction from arrays, nested VO support via Forge |
| Repository | Abstract base + Eloquent impl with 12 filter operators, caching, pagination, sorting |
| Transactions | Auto-commit on Result::success, auto-rollback on Result::failure |
| Domain events | Aggregates record → Results carry → bus dispatches post-commit |
| Queue integration | ShouldQueue marker → automatic defer via ExecuteCommandJob |
| Framework agnostic | PSR-11 core, Laravel adapter with 13 service providers |
Part of the Talred Ecosystem
Talred CQRS is the application layer — it bridges domain logic and transport:
When used together: HTTP resolves the pipeline via attributes → Forge hydrates the command with validated VOs → CQRS dispatches through the bus, captures events, wraps transactions → HTTP transforms and returns the response. Sub-10ms package overhead for the entire vertical stack.
| Package | Layer | Link |
|---|---|---|
| talred/forge | Domain | packages/forge |
| talred/cqrs | Application | You are here |
| talred/http | Transport | packages/http |
QA
82 tests, 139 assertions covering Result/Option monads, command and query bus dispatch, validator chains, event dispatching, message hydration, argument resolution, and Talred namespace compatibility.
Documentation
Full documentation is available in the docs/ directory, organized for serving via Nuxt Content.
License
MIT © 2026 Redouane Taleb
All versions of cqrs with dependencies
psr/container Version ^2.0
symfony/process Version ^7.3
symfony/serializer Version ^7.3
symfony/property-access Version ^7.3
symfony/property-info Version ^7.3
talred/forge Version ^1.0