artisansdk/cqrs
59.0
Adequate · 22 September 2026
2.7k
lines of production code
PHP
primary language
7
measurements over time
What this system is
This system is a PHP library implementing the Command Query Responsibility Segregation (CQRS) pattern, designed to manage command and query execution with built-in support for caching, eventing, and database transactions. It provides a structured way to handle asynchronous job dispatching, job chaining, and argument validation through reusable traits and wrapper classes. The codebase has been modernized to support Laravel 10-13 and includes comprehensive test coverage for its core components.
Features
Introduced Chain and Pending job wrappers for job chaining and dispatching
Added new Chain and Pending classes in the Jobs namespace to support job chaining and deferred dispatching. The Chain class manages a sequence of jobs, while the Pending class provides a fluent interface for configuring job properties (connection, queue, delay) before dispatching. The existing Job class was moved from src/Commands to src/Jobs and updated to use the new PSR-3 logger instead of Laravel's Log facade, and now accepts an optional LoggerInterface for dependency injection.
src/Jobs · high confidence
New CQRS bus wrappers for caching, events, and transactions
The package introduces three new wrapper classes in the \ArtisanSdk\\CQRS\\Buses\ namespace to enhance command and query handling. The \Cached\ class enables query caching with configurable TTL, key/subkey, and expiration settings. The \Evented\ class automatically fires before and after events for runnables, supporting both explicit event methods and automatic tense-based event names. The \Transaction\ class wraps runnables in database transactions, ensuring rollback on failure or abort conditions. These wrappers are now located in \src/Buses\ and implement the \Runnable\ contract, providing a consistent interface for caching, eventing, and transactional behavior.
src/Buses · high confidence
New CQRS concern traits for commands, queries, and jobs
The \src/Concerns\ directory now contains a set of new PHP traits that provide core functionality for the CQRS (Command/Query) pattern. The \Arguments\ trait manages command/query arguments with validation and typo-tolerant lookups. \Bust\ adds a static method to clear cache keys. \Dispatchable\ and \Queueable\ provide methods to dispatch jobs synchronously, asynchronously, or in chains, while \Queues\ aggregates queue-related traits. \Save\ handles model persistence with detailed error reporting, and \Validation\ offers flexible argument validation via functions, callables, or rules arrays. The existing \CQRS\, \Handle\, and \Silencer\ traits have been moved from \src/Traits\ to \src/Concerns\ and updated to use strict types and modern PHP practices.
src/Concerns · high confidence
Removals
Removed legacy CQRS traits
The Arguments, Queues, and Save traits have been removed from the codebase. This eliminates the custom implementations for handling command arguments, queue dispatching, and model saving, likely as part of a broader refactor to simplify the architecture and reduce complexity.
src/Traits · high confidence
Removed the Evented command wrapper class
The \Evented\ class, which previously wrapped command execution to automatically fire before and after events, has been removed from the codebase. This change eliminates the automatic event emission behavior for commands that previously relied on this wrapper, requiring any existing event-triggering logic to be handled differently or removed.
src/Commands · high confidence
Behavioural changes
Refactor event base class and add Invalidated event
The base Event class has been refactored to remove the Illuminate Queue serialization dependency and instead use dynamic property assignment for payload data, while also adding explicit event and entity name tracking. A new Invalidated event class has been introduced to handle cache invalidation tags, allowing users to specify which cache tags should be cleared when the event is fired.
src/Events · high confidence
Refactored CQRS base classes and added caching, queueing, and pagination support
The CQRS base classes (Command, Query, Builder) were restructured: Command and Query moved to the root namespace, traits were extracted to Concerns, and the Builder class gained support for macros, queuing, and caching (via new cache/nocache/ttl methods). The Query class now supports pagination with column selection and a toBase() method. The Dispatcher was updated to resolve classes via the container, handle event namespacing changes, and wrap commands with caching, transactional, and eventable buses.
src · medium confidence
Test coverage
Added test fakes and unit tests for CQRS components; Added unit tests for CQRS buses and test infrastructure; Added unit tests for CQRS components; Added unit tests for CQRS concerns; Added unit tests for Job, Chain, and Pending dispatching; Updated test configuration and added local development environment.
Dependencies
Upgrade Laravel and PHP version requirements to support Laravel 10-13
The package now requires PHP 8.0 or higher and has updated its Laravel dependencies to support versions 10, 11, 12, and 13. This includes upgrading \illuminate/\*\ packages to their latest supported versions and updating dev dependencies to use Pest 2/3/4 and Laravel Pint, replacing older tools like PHPUnit and PHP CS Fixer.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 55 → 59 (+3.5)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 100 → 100 (-0.2)
- Architecture 100 → 100 (+0.0)
- Maturity 65 → 67 (+2.2)
- Readiness 26 → 32 (+6.1)
- Security 99 → 99 (+0.4)
Resolved (7)
- Coverage not included — suite not readable by the collector
- Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
- Further orphaned files (smaller)
- Medium IaC: CKV_DOCKER_3 (Dockerfile)
- No exposed public API
- Off-boarding risk: anonymized user #1
- Test reliability not included
New (10)
- Ambiguous distinction between fresh() and refresh(). In many ORMs, fresh reloads from DB and refresh might imply a different state reset, but here they appear in both Builder and Cached contexts without clear semantic differentiation in the signatures. If they do the same thing, it is redundant. If they differ, the naming is confusing (e.g., fresh vs reload is clearer).
- Dependency hygiene PARTLY measured — Composer dependencies read, no committed lock to grade for currency
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Duplicated block (7 lines × 3) (src/Buses/Cached.php)
- Inconsistent method availability. Builder has toSql(), but Query also has toSql(). However, Cached and Evented (which wrap Query/Command logic) do not expose toSql(). This breaks the expectation that all query-like objects can be inspected for SQL.
- Inconsistent queueing API. Builder has a queue() method. Handle concern has a queue() method. Queueable is a concern with properties. It is unclear if Builder.queue() queues the command/query or returns a queue builder. The interaction between the Queueable concern and the queue() method on Builder is not explicit.
- Inconsistent return types and naming for cache invalidation. Builder and Cached use bust() returning self (fluent), while the Bust concern uses bust() returning bool. Additionally, Builder and Cached also expose invalidate() which likely does the same thing as bust(), creating internal redundancy within those classes.
- Medium IaC: WD-DOCKER-0003 (Dockerfile)
- Multiple entry points for execution with unclear hierarchy. Dispatcher.dispatch() takes a class, while Command.make() and Query.make() return instances that are then executed via run(). Builder also has run(). It is unclear if Dispatcher.dispatch() is the canonical entry point or if make()->run() is preferred. This creates confusion for users on how to initiate a CQRS operation.
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
artisansdk/cqrs was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 22 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 314f1ba91b5d17841e74d3da81979abf106d7390 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-821afab8930d.