PHPackages                             prooph/pdo-event-store - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. prooph/pdo-event-store

ActiveLibrary[Database &amp; ORM](/categories/database)

prooph/pdo-event-store
======================

Prooph PDO EventStore

v1.16.5(11mo ago)1121.2M↓23.4%60[5 issues](https://github.com/prooph/pdo-event-store/issues)17BSD-3-ClausePHPPHP ^8.1CI passing

Since Jan 12Pushed 11mo ago11 watchersCompare

[ Source](https://github.com/prooph/pdo-event-store)[ Packagist](https://packagist.org/packages/prooph/pdo-event-store)[ Docs](http://getprooph.org/)[ RSS](/packages/prooph-pdo-event-store/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (54)Used By (17)

pdo-event-store
===============

[](#pdo-event-store)

[![Build Status](https://camo.githubusercontent.com/87e4d8958f628a2405828b81e1638474664470ac91744a003abd12279d150841/68747470733a2f2f7472617669732d63692e636f6d2f70726f6f70682f70646f2d6576656e742d73746f72652e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/prooph/pdo-event-store)[![Coverage Status](https://camo.githubusercontent.com/cb11b932cb28dab3ced303ede84d888da2a973da0b8ba8637474cd540ea5157b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f70726f6f70682f70646f2d6576656e742d73746f72652f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/prooph/pdo-event-store?branch=master)[![Gitter](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/prooph/improoph)

PDO EventStore implementation for [Prooph EventStore](https://github.com/prooph/event-store)

Requirements
------------

[](#requirements)

- PHP &gt;= 7.3
- PDO\_MySQL Extension or PDO\_PGSQL Extension

For MariaDB you need server version &gt;= 10.2.11.
**Performance Impact**: see \[MariaDB Indexes and Efficiency\](docs/variants.md#MariaDB Indexes and Efficiency)

For MySQL you need server version &gt;= 5.7.9.

For Postgres you need server version &gt;= 9.4.

Attention: Since v1.6.0 MariaDB Server has to be at least 10.2.11 due to a bugfix in MariaDB, see .

Setup
-----

[](#setup)

For MariaDB run the script in `scripts/mariadb/01_event_streams_table.sql` on your server.

For MySQL run the script in `scripts/mysql/01_event_streams_table.sql` on your server.

For Postgres run the script in `scripts/postgres/01_event_streams_table.sql` on your server.

This will setup the required event streams table.

If you want to use the projections, run additionally the scripts `scripts/mariadb/02_projections_table.sql`(for MariaDB), `scripts/mysql/02_projections_table.sql` (for MySQL) or `scripts/postgres/02_projections_table.sql` (for Postgres) on your server.

Upgrade from 1.6 to 1.7
-----------------------

[](#upgrade-from-16-to-17)

Starting from v1.7 the pdo-event-store uses optimized table schemas. The upgrade can be done in background with a script optimizing that process. A downtime for the database should not be needed. In order to upgrade your existing database, you have to execute:

- MariaDB

```
ALTER TABLE `event_streams` MODIFY `metadata` LONGTEXT NOT NULL;
ALTER TABLE `projections` MODIFY `position` LONGTEXT;
ALTER TABLE `projections` MODIFY `state` LONGTEXT;

```

Then for all event-streams (`SELECT stream_name FROM event_streams`)

```
ALTER TABLE  MODIFY `payload` LONGTEXT NOT NULL;
ALTER TABLE  MODIFY `metadata` LONGTEXT NOT NULL,

```

- MySQL

nothing to upgrade

- Postgres

For all event-streams (`SELECT stream_name FROM event_streams`)

```
ALTER TABLE  MODIFY event_id UUID NOT NULL;

```

Additional note:

When using Postgres, the event\_id has to be a valid uuid, so be careful when using a custom MetadataMatcher, as the event-store could throw an exception when passing a non-valid uuid (f.e. "foo") as uuid.

The migration is strongly recommended, but not required. It's fully backward-compatible. The change on Postgres is only a microoptimization, the change on MariaDB prevents errors, when the stored json gets too big.

Introduction
------------

[](#introduction)

[![Prooph Event Store v7](https://camo.githubusercontent.com/4725d7b3688a8c1dcb4090fd5b93f327fddf49a77fb60048d3d58e92199ca494/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f51687044497159517a67302f302e6a7067)](https://www.youtube.com/watch?v=QhpDIqYQzg0)

Tests
-----

[](#tests)

If you want to run the unit tests locally you need a runnging MySql server listening on port `3306`and a running Postgres server listening on port `5432`. Both should contain an empty database `event_store_tests`.

Run Tests With Composer
-----------------------

[](#run-tests-with-composer)

### MariaDb

[](#mariadb)

`$ vendor/bin/phpunit -c phpunit.xml.mariadb`

### MySql

[](#mysql)

`$ vendor/bin/phpunit -c phpunit.xml.mysql`

### Postgres

[](#postgres)

`$ vendor/bin/phpunit -c phpunit.xml.postgres`

Run Tests With Docker Compose
-----------------------------

[](#run-tests-with-docker-compose)

### MariaDb

[](#mariadb-1)

```
docker-compose -f docker-compose-tests.yml run tests composer run-script test-mariadb --timeout 0; \
docker-compose -f docker-compose-tests.yml stop
```

### MySql

[](#mysql-1)

```
docker-compose -f docker-compose-tests.yml run tests composer run-script test-mysql --timeout 0; \
docker-compose -f docker-compose-tests.yml stop
```

### Postgres

[](#postgres-1)

```
docker-compose -f docker-compose-tests.yml run tests composer run-script test-postgres --timeout 0; \
docker-compose -f docker-compose-tests.yml stop
```

Support
-------

[](#support)

- Ask questions on Stack Overflow tagged with [\#prooph](https://stackoverflow.com/questions/tagged/prooph).
- File issues at .
- Say hello in the [prooph gitter](https://gitter.im/prooph/improoph) chat.

Contribute
----------

[](#contribute)

Please feel free to fork and extend existing or add new plugins and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.

License
-------

[](#license)

Released under the [New BSD License](LICENSE).

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance51

Moderate activity, may be stable

Popularity56

Moderate usage in the ecosystem

Community40

Growing community involvement

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 63.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~59 days

Recently: every ~19 days

Total

53

Last Release

334d ago

PHP version history (4 changes)v1.0.0-beta1PHP ^7.1

v1.13.0PHP ^7.3 | ^8.0

v1.16.0PHP ^8.2

v1.16.2PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7341005?v=4)[prooph](/maintainers/prooph)[@prooph](https://github.com/prooph)

---

Top Contributors

[![prolic](https://avatars.githubusercontent.com/u/394428?v=4)](https://github.com/prolic "prolic (467 commits)")[![basz](https://avatars.githubusercontent.com/u/143068?v=4)](https://github.com/basz "basz (119 commits)")[![fritz-gerneth](https://avatars.githubusercontent.com/u/1294731?v=4)](https://github.com/fritz-gerneth "fritz-gerneth (32 commits)")[![oqq](https://avatars.githubusercontent.com/u/7161145?v=4)](https://github.com/oqq "oqq (23 commits)")[![grzegorzstachniukalm](https://avatars.githubusercontent.com/u/41567377?v=4)](https://github.com/grzegorzstachniukalm "grzegorzstachniukalm (14 commits)")[![enumag](https://avatars.githubusercontent.com/u/539462?v=4)](https://github.com/enumag "enumag (11 commits)")[![unixslayer](https://avatars.githubusercontent.com/u/1131246?v=4)](https://github.com/unixslayer "unixslayer (10 commits)")[![ghettovoice](https://avatars.githubusercontent.com/u/4323000?v=4)](https://github.com/ghettovoice "ghettovoice (9 commits)")[![dragosprotung](https://avatars.githubusercontent.com/u/1081073?v=4)](https://github.com/dragosprotung "dragosprotung (7 commits)")[![gquemener](https://avatars.githubusercontent.com/u/668604?v=4)](https://github.com/gquemener "gquemener (7 commits)")[![codeliner](https://avatars.githubusercontent.com/u/5131987?v=4)](https://github.com/codeliner "codeliner (4 commits)")[![zluiten](https://avatars.githubusercontent.com/u/1336070?v=4)](https://github.com/zluiten "zluiten (4 commits)")[![volkyeth](https://avatars.githubusercontent.com/u/847070?v=4)](https://github.com/volkyeth "volkyeth (3 commits)")[![sandrokeil](https://avatars.githubusercontent.com/u/3597436?v=4)](https://github.com/sandrokeil "sandrokeil (3 commits)")[![rodion-k](https://avatars.githubusercontent.com/u/2526460?v=4)](https://github.com/rodion-k "rodion-k (2 commits)")[![AlessandroMinoccheri](https://avatars.githubusercontent.com/u/3356506?v=4)](https://github.com/AlessandroMinoccheri "AlessandroMinoccheri (2 commits)")[![darrylhein](https://avatars.githubusercontent.com/u/376976?v=4)](https://github.com/darrylhein "darrylhein (2 commits)")[![jiripudil](https://avatars.githubusercontent.com/u/1042159?v=4)](https://github.com/jiripudil "jiripudil (1 commits)")[![alle](https://avatars.githubusercontent.com/u/122359?v=4)](https://github.com/alle "alle (1 commits)")[![dannydorfel](https://avatars.githubusercontent.com/u/432109?v=4)](https://github.com/dannydorfel "dannydorfel (1 commits)")

---

Tags

cqrsdddevent-sourcingevent-storemysqlphppostgres

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/prooph-pdo-event-store/health.svg)

```
[![Health](https://phpackages.com/badges/prooph-pdo-event-store/health.svg)](https://phpackages.com/packages/prooph-pdo-event-store)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)[usmanhalalit/laracsv

A Laravel package to easily generate CSV files from Eloquent model.

6151.7M4](/packages/usmanhalalit-laracsv)[hipsterjazzbo/landlord

A simple, single database multi-tenancy solution for Laravel 5.2+

613270.0k1](/packages/hipsterjazzbo-landlord)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
