Skip to content
CAI
Software that uses CAICheck a score

artisansdk/cqrs

52.7

Adequate · 9 November 2026

2.7k

lines of production code

PHP

primary language

10

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

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 cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 53 → 53 (-0.0)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 74 → 74 (+0.0)
  • Architecture 98 → 98 (-0.5)
  • Maturity 51 → 51 (+0.0)
  • Readiness 35 → 35 (+0.0)
  • Security 99 → 99 (+0.0)

Resolved (6)

  • Duplicate operations for cache bypass. Both fresh() and refresh() exist on Builder and Cached. In many ORMs, fresh implies a new instance/query, while refresh implies reloading existing state, but here they likely serve the same purpose of bypassing cache for the current operation.
  • Duplicate operations for cache invalidation. Both invalidate() and bust() exist on Builder and Cached with identical signatures and likely identical intent (clearing cache).
  • Inconsistent dispatching API. Dispatcher has separate methods for command, query, and dispatch. dispatch likely handles all, but the existence of specific methods suggests a lack of unified interface. Meanwhile, Builder uses run(), get(), queue().
  • Inconsistent execution semantics. Command.run() executes a command. Query.run() executes a query. However, Cached.run() and Evented.run() are wrappers that likely delegate to the underlying Runnable. The naming is consistent, but the underlying Runnable types (Command vs Query) have different return expectations (void vs data), which is not reflected in the method signature or documentation, leading to potential misuse.
  • Inconsistent method availability across similar types. Builder has toSql(), but Query also has toSql(). However, Cached and Evented (which wrap Runnable like Query) do NOT have toSql(). This suggests toSql() is a feature of the query builder aspect, but it's not consistently exposed on all query-like wrappers.
  • Inconsistent return types and naming for cache invalidation. Builder and Cached use bust() returning self (fluent), while the Bust concern defines bust() returning bool. This creates ambiguity about whether the operation succeeded or allows chaining.

Written by cca.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 9 November 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.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.4+preprod-464a0040a931.