PHPackages                             j5ik2o/event-store-adapter-php - 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. j5ik2o/event-store-adapter-php

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

j5ik2o/event-store-adapter-php
==============================

This library is designed to turn DynamoDB into an Event Store for CQRS/Event Sourcing.

v1.0.18(7mo ago)73.6k↑71.7%1[1 issues](https://github.com/j5ik2o/event-store-adapter-php/issues)[7 PRs](https://github.com/j5ik2o/event-store-adapter-php/pulls)MITPHPPHP &gt;= 8.1CI passing

Since Oct 16Pushed 1w ago1 watchersCompare

[ Source](https://github.com/j5ik2o/event-store-adapter-php)[ Packagist](https://packagist.org/packages/j5ik2o/event-store-adapter-php)[ RSS](/packages/j5ik2o-event-store-adapter-php/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (7)Versions (29)Used By (0)

event-store-adapter-php
=======================

[](#event-store-adapter-php)

[![CI](https://github.com/j5ik2o/event-store-adapter-php/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/j5ik2o/event-store-adapter-php/actions/workflows/ci.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/e497d39a169c9559439316898400d205bb113f1968cfc005bf5fbc35da6c9771/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a35696b326f2f6576656e742d73746f72652d616461707465722d7068702e7376673f7374796c653d666c6174)](https://packagist.org/packages/j5ik2o/event-store-adapter-php)[![Renovate](https://camo.githubusercontent.com/b5597454793b610a0fbbacfd09eba69b6111bcba053169699b5c2cac39ab1240/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72656e6f766174652d656e61626c65642d627269676874677265656e2e737667)](https://renovatebot.com)[![License](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)[![](https://camo.githubusercontent.com/ca0f27a2186460adc116486480b5edf90f3ae85a5bf5f58accc80364a081bc6a/68747470733a2f2f746f6b65692e72732f62312f6769746875622f6a35696b326f2f6576656e742d73746f72652d616461707465722d706870)](https://github.com/XAMPPRocky/tokei)

This library is designed to turn DynamoDB into an Event Store for CQRS/Event Sourcing.

The Status is WIP.

Installation
------------

[](#installation)

```
composer require j5ik2o/event-store-adapter-php
```

Usage
-----

[](#usage)

You can easily implement an Event Sourcing-enabled repository using EventStore.

```
final class UserAccountRepository {
  private readonly EventStore $eventStore;

  public function __construct(EventStore $eventStore) {
    $this->eventStore = $eventStore;
  }

  public function storeEvent(UserAccountEvent $event, int $version): void {
    $this->eventStore->persistEvent($event, $version);
  }

  public function storeEventAndSnapshot(UserAccountEvent $event, UserAccount $userAccount): void {
    $this->eventStore->persistEventAndSnapshot($event, $userAccount);
  }

  public function findById(UserAccountId $id): ?UserAccount {
    $latestSnapshot = $this->eventStore->getLatestSnapshotById($id);
    if ($latestSnapshot === null) {
      return null;
    }
    $events = $this->eventStore->getEventsByIdSinceSequenceNumber($id, $latestSnapshot->getSequenceNumber());
    return UserAccount::replay($events, $latestSnapshot);
  }
}
```

The following is an example of the repository usage.

```
$eventStore = EventStoreFactory：：create(
  $client,
  $journalTableName,
  $snapshotTableName,
  $journalAidIndexName,
  $snapshotAidIndexName,
  $shardCount,
  $eventConverter,
  $snapshotConverter,
);

$userAccountRepository = new UserAccountRepository($eventStore);

$userAccountId = new UserAccountId();

// Generates a new aggregate
[$userAccount1, $created] = UserAccount::create($userAccountId, "test-1");
// Store the snapshot and event at first
$userAccountRepository->storeEventAndSnapshot($created, $userAccount1);

// Replay if necessary
$userAccount2 = $userAccountRepository->findById($userAccountId);
// Executes business logic
[$userAccount3, $renamed] = $userAccount2->rename("test-2");
// Store the event only
$userAccountRepository->storeEvent($renamed, $userAccount3->getVersion());
```

Table Specifications
--------------------

[](#table-specifications)

See [docs/DATABASE\_SCHEMA.md](docs/DATABASE_SCHEMA.md).

CQRS/Event Sourcing Example
---------------------------

[](#cqrsevent-sourcing-example)

See [akinoriakatsuka/cqrs-es-example-php](https://github.com/akinoriakatsuka/cqrs-es-example-php).

License.
--------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

Links
-----

[](#links)

- [Common Documents](https://github.com/j5ik2o/event-store-adapter)

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance80

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 82.5% 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 ~42 days

Recently: every ~79 days

Total

19

Last Release

226d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f37f17b6eb2e8c7674f8868a787cc7d602bd5a61cceef4fd6a0b0d0486408b4?d=identicon)[j5ik2o](/maintainers/j5ik2o)

---

Top Contributors

[![j5ik2o](https://avatars.githubusercontent.com/u/461711?v=4)](https://github.com/j5ik2o "j5ik2o (99 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (21 commits)")

---

Tags

cqrsddddynamodbevent-sourcing

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/j5ik2o-event-store-adapter-php/health.svg)

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

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.7k285.7M1.0k](/packages/league-flysystem-aws-s3-v3)[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

10.2k3.5k](/packages/leantime-leantime)[baopham/dynamodb

Eloquent syntax for DynamoDB

4986.0M6](/packages/baopham-dynamodb)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M201](/packages/laravel-ai)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)

PHPackages © 2026

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