Skip to content
CAI
Software that uses CAICheck a score

damgru/stupid-event-sourcing

43.9

Weak · 10 November 2026

731

lines of production code

PHP

primary language

9

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is an event-sourcing infrastructure library that manages domain events and synchronizes read models. It provides an AggregateRoot base class to simplify recording domain events and an EventStore optimized for efficient querying. Additionally, it includes a ReadModel framework to process events and maintain synchronized local state, coordinated by a manager that tracks processing progress.

Features

Introduce Read Model infrastructure for event-driven data synchronization

Added new PHP classes in the src/ReadModel directory to support event sourcing read models. This includes the ReadModel and ReadModelManager interfaces, along with concrete implementations like InMemoryReadModel and PdoReadModel, which handle pulling events from the event store and updating local state. A PdoReadModelManager is also introduced to coordinate multiple read models, persist their last processed event timestamps in a 'read\_models' database table, and trigger updates.

src/ReadModel · high confidence

Behavioural changes

AggregateRoot adds a recordEvent helper method

The AggregateRoot class now includes a protected recordEvent method that simplifies the creation and recording of domain events. By wrapping the AggregateEvent::create factory, this new helper allows subclasses to easily record events with a specific name, payload, and category, reducing boilerplate when implementing domain logic.

src · high confidence

Improved EventStore query performance with database indexes

The PdoEventStore now creates database indexes on the 'aggregate\_id' and 'created' columns of the events table. This change optimizes query performance for lookups and time-based filtering, addressing the initialization logic in the EventStore component.

src/EventStore · medium confidence

Dependencies

Bumped package version to 0.0.3

The composer.json manifest was updated to version 0.0.3, reflecting a change in the package's version number.

(dependencies) · medium 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 44 → 44 (+0.0)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 70 → 70 (+0.0)
  • Architecture 69 → 69 (+0.0)
  • Maturity 50 → 50 (+0.0)
  • Readiness 23 → 23 (+0.0)
  • Security 100 → 100 (+0.0)

Resolved (5)

  • Ambiguous reconstruction intent. AggregateRoot.fromEvents takes a single AggregateEvent (singular type hint but likely iterable in usage given the name) to reconstruct state, while Repository.load handles the full persistence lifecycle. The method name fromEvents (plural intent) accepting a singular type hint AggregateEvent is confusing. Furthermore, having a static-style reconstruction method on the AggregateRoot itself bypasses the Repository, which can lead to inconsistent state if the Repository performs additional hydration logic.
  • Inconsistent naming for similar operations. ReadModelManager uses registerReadModel while its concrete implementation PdoReadModelManager uses withReadModel. These appear to perform the same function (associating a read model with the manager), but the different verbs (register vs with) create confusion about whether they have different side effects or lifecycles.
  • Inconsistent parameter typing. The interface/base EventStore and its implementations accept AggregateEvent (singular) for the add method, despite the parameter name being plural events. This suggests the method is intended to handle multiple events, but the type hint indicates a single event. This is a type signature inconsistency.
  • No tests found
  • Redundant creation paths with inconsistent signatures. The static factory create omits the version parameter (likely setting it to 0 or 1 internally), while the constructor requires it. This creates two ways to instantiate the same immutable value object with different required arguments, confusing users about whether they should use the factory or the constructor.

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

damgru/stupid-event-sourcing 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 10 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 7e618e12d82c8ee03d612532aa8e7021f1b4837c — 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.