prooph/pdo-event-store
65.9
Adequate · 9 November 2026
7.6k
lines of production code
PHP
primary language
10
measurements over time
What this system is
This system is a generic PHP event store library that provides database-agnostic persistence for event streams and projections using PDO. It supports MariaDB, MySQL, and PostgreSQL backends, offering features such as distributed write locking, gap detection for event replay, and configurable persistence strategies. The library manages the storage of event metadata and projection state while handling concurrency and schema-specific optimizations across different database engines.
How it got here
2016 — PDO multi-database abstraction
12 changes.
The project refactored its architecture to replace the legacy MySQL-specific adapter with a generic PDO-based event store supporting MariaDB, MySQL, and PostgreSQL. This shift involved introducing database-specific persistence strategies, updating container factories, and establishing comprehensive test suites to ensure compatibility across all three database vendors.
2017–2019 — Multi-database support and gap detection
8 changes.
This period focused on extending the event sourcing library to support MariaDB, MySQL, and PostgreSQL through new schema scripts, persistence strategies, and database-specific write lock implementations. It also introduced a gap detection mechanism for projections to handle event stream inconsistencies and added utility classes for JSON handling and PostgreSQL identifier management.
Features
Add database-specific write lock strategies for event streams
New lock strategy implementations have been added to support distributed locking for event-stream appends across different database backends. The \MariaDbMetadataLockStrategy\ and \MysqlMetadataLockStrategy\ utilize native \GET\_LOCK\ and \RELEASE\_LOCK\ functions, with the MariaDB variant explicitly handling integer return values from \GET\_LOCK\ to ensure compatibility. A \PostgresAdvisoryLockStrategy\ is introduced to use PostgreSQL's \pg\_advisory\_lock\ functions, and a \NoLockStrategy\ is provided for environments where locking is not required.
src/WriteLockStrategy · high confidence
Add gap detection to projections
Projections now include a gap detection mechanism to handle scenarios where events are skipped due to transaction visibility issues or rollbacks. A new GapDetector interface and default GapDetection implementation allow projectors to detect gaps in the event stream and automatically retry to fill them. This feature is enabled via the OPTION\_GAP\_DETECTION option in PdoEventStoreProjector and PdoEventStoreReadModelProjector, and can be configured with custom retry schedules and detection windows to avoid unnecessary retries during replay.
src/Projection · high confidence
Added MariaDB schema for event streams and projections
New SQL migration scripts have been added to initialize the MariaDB database with tables for event streams and projections. The event streams table stores stream metadata and names, while the projections table tracks projection state and position, including validation checks to ensure JSON validity for specific fields.
scripts/mariadb · high confidence
Added MySQL schema definitions for event streams and projections
New SQL migration scripts have been added to define the \event\_streams\ and \projections\ tables for MySQL. The \event\_streams\ table uses a 64-bit integer (\BIGINT\) for the primary key and stores stream metadata and category information, while the \projections\ table tracks projection state, position, and status using JSON fields and a 28-character status string.
scripts/mysql · high confidence
Added PostgreSQL schema for event streams and projections
New SQL migration scripts have been added to define the database structure for PostgreSQL. The \event\_streams\ table stores event data using a big serial ID, stream identifiers, JSONB metadata, and a category index, while the \projections\ table tracks projection state, position, and status using JSONB fields. These tables provide the underlying storage layer for the event store and projection mechanisms.
scripts/postgres · high confidence
New JSON utility and PostgreSQL identifier helper
The library now includes a new \Json\ utility class in \src/Util\ that provides static \encode\ and \decode\ methods for JSON handling, featuring specific flags like \JSON\_UNESCAPED\_UNICODE\ and \JSON\_BIGINT\_AS\_STRING\, and throwing \JsonException\ on errors. Additionally, a \PostgresHelper\ trait was added to \src/Util/PostgresHelper.php\, introducing \quoteIdent\ and \extractSchema\ methods to simplify and optimize the quoting of PostgreSQL identifiers and the extraction of schema names from fully qualified table names.
src/Util · high confidence
Removals
Removal of MySQL-specific event streams table script
The SQL script defining the \event\_streams\ table for MySQL has been removed from the repository. This change eliminates the dedicated MySQL schema definition, aligning with the project's shift towards PostgreSQL compatibility as indicated by the removal of MySQL-specific database artifacts.
scripts · high confidence
Behavioural changes
MariaDB persistence strategies now use utf8mb4 and generated columns
The MariaDB persistence strategies (Simple, Aggregate, and Single Stream) have been updated to use the utf8mb4 character set and collation for all tables, ensuring full Unicode support. Additionally, the Aggregate and Single Stream strategies now utilize MariaDB's generated columns to store and index metadata fields like \_aggregate\_version, \_aggregate\_id, and \_aggregate\_type, improving query performance and data integrity without requiring application-level processing for these specific fields.
src/PersistenceStrategy · high confidence
Migrate CI to Docker and add multi-database test configurations
The project replaces the legacy Travis CI configuration with a Docker-based test environment, introducing a Dockerfile for PHP 8.3 and a docker-compose file that orchestrates MariaDB 10.3, MySQL 5.7, and PostgreSQL services. To support this, three distinct PHPUnit configuration files (phpunit.mariadb.xml, phpunit.mysql.xml, phpunit.postgres.xml) are added, each targeting a specific database driver and excluding the source files of the other vendors. The old single phpunit.xml.dist, the legacy .php\_cs coding standard file, and the .coveralls.yml file are removed.
(repo-wide) · high confidence
Refactored container factories for event stores and projection managers
The container wiring in src/Container has been restructured to use a new AbstractEventStoreFactory and AbstractProjectionManagerFactory. Event store factories (MySql, Postgres, MariaDb) now support configurable write-lock strategies, plugin injection, and metadata enrichers, while projection manager factories are unified under a common abstract base. The old MySQLEventStoreAdapterFactory has been replaced by these new factories, simplifying configuration and enabling consistent behavior across database implementations.
src/Container · high confidence
Refactored event store architecture with new PDO implementations and removed legacy adapters
The library has been refactored to replace the legacy MySQL adapter with new, database-specific PDO event stores for MariaDB, MySQL, and PostgreSQL. This change introduces a unified \PdoEventStore\ interface and a new \PersistenceStrategy\ abstraction, replacing the old \IndexingStrategy\ and \TableNameGeneratorStrategy\. Users must now provide a specific persistence strategy (e.g., \MariaDbPersistenceStrategy\) and a \WriteLockStrategy\ when instantiating the stores. The legacy \MySQLEventStoreAdapter\ and related classes have been removed, and the \DefaultMessageConverter\ now explicitly maps message properties to an array structure for storage.
src · high confidence
Refactored exception hierarchy and introduced factory methods for PDO-specific errors
The exception classes in the \src/Exception\ directory have been restructured to implement a new \PdoEventStoreException\ interface, replacing previous adapter-specific strategies. New factory methods have been added to \ConcurrencyException\ (via \ConcurrencyExceptionFactory\) and \RuntimeException\ to construct detailed error messages from PDO statement error info, improving diagnostic clarity for concurrency and runtime issues. Additionally, specific exception types like \InvalidArgumentException\, \JsonException\, and \ProjectionNotCreatedException\ have been introduced or refined to provide more precise error handling for JSON decoding, projection creation, and invalid argument scenarios within the PDO event store.
src/Exception · high confidence
Test coverage
Added SQL schema scripts for event store and projection tables; Added comprehensive PDO event store tests for MySQL, MariaDB, and PostgreSQL; Added container factory tests for MariaDB, MySQL, and Postgres event stores and projection managers; Added custom persistence strategy test fixtures for MariaDB, MySQL, and PostgreSQL; Added tests for Postgres persistence strategy table name generation; Added tests for WriteLockStrategy implementations; Expanded test coverage for Pdo projections with custom schemas and tables.
Dependencies
Upgrade to PHP 8.1 and PHPUnit 10 with PDO adapter rename
The package has been renamed from prooph/event-store-mysql-adapter to prooph/pdo-event-store, reflecting a shift from a MySQL-specific adapter to a generic PDO implementation. The minimum PHP version is raised to 8.1, and the core dependency prooph/event-store is updated to ^v7.12.3. Development tools are upgraded significantly, including PHPUnit to ^10.0 and interop-config to ^2.0.1, while the namespace changes from Prooph\\EventStore\\Adapter\\ to Prooph\\EventStore\\Pdo\\. New composer scripts allow running tests against PostgreSQL, MariaDB, and MySQL environments.
(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 62 → 66 (+3.8)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 64 → 64 (+0.0)
- Architecture 98 → 96 (-1.2)
- Maturity 52 → 60 (+8.1)
- Readiness 62 → 62 (+0.0)
- Security 97 → 97 (+0.0)
Resolved (1)
- Duplicate types with identical signatures. GapDetection and GapDetector appear to be functionally identical classes with different names, likely a copy-paste error or legacy naming confusion.
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
prooph/pdo-event-store 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 ed2b072addb4b63595ba30f10ccdab9a08ecfdaf — 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.