PHPackages                             gember/event-sourcing-universal-service-provider - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. gember/event-sourcing-universal-service-provider

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gember/event-sourcing-universal-service-provider
================================================

Universal service provider for Gember Event Sourcing (gember/event-sourcing)

0.9.0(8mo ago)22[5 PRs](https://github.com/GemberPHP/event-sourcing-universal-service-provider/pulls)MITPHPPHP ^8.3CI passing

Since May 6Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/GemberPHP/event-sourcing-universal-service-provider)[ Packagist](https://packagist.org/packages/gember/event-sourcing-universal-service-provider)[ RSS](/packages/gember-event-sourcing-universal-service-provider/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (18)Versions (17)Used By (0)

🫚 Gember Event Sourcing Universal Service Provider
==================================================

[](#-gember-event-sourcing-universal-service-provider)

[![Software License](https://camo.githubusercontent.com/f251623e510f5909f16ae3f4e6e548dac11340b9fde1a99be26b015b39272c00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/05de8fa997dec7bd6b39b7af8c030c734835c6871547f8b2d9ae87e4299ebc8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e332d3838393242462e7376673f7374796c653d666c6174)](http://www.php.net)

Universal Service Provider for [Gember Event Sourcing ](https://github.com/GemberPHP/event-sourcing), compatible with any application or framework that supports [container-interop/service-provider](https://github.com/container-interop/service-provider).

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

[](#installation)

Install the service provider with composer:

```
composer require gember/event-sourcing-universal-service-provider
```

Configuration
-------------

[](#configuration)

This package installs *Gember Event Sourcing* with all required dependency adapters. Some of these adapters need to be configured.

By default, it uses the following configuration:

**PSR-11 Container definition ():**

```
use Doctrine\DBAL\Connection;
use Gember\IdentityGeneratorSymfony\Ulid\SymfonyUuidIdentityGenerator;
use Psr\Container\ContainerInterface;
use Symfony\Component\Serializer\Serializer;

return [
    'gember_event_sourcing' => fn(ContainerInterface $container) => [
        'message_bus' => [
            'symfony' => [
                'event_bus' => $container->get('event.bus'),
            ],
        ],
        'cache' => [
            'enabled' => false,
            // set a PSR-6 or PSR-16 implementation
            // 'psr16' => $container->get('cache.file'),
            // 'psr6' => $container->get('cache.file'),
        ],
        'serializer' => [
            'symfony' => [
                'serializer' => $container->get(Serializer::class),
            ],
        ],
        'event_store' => [
            'rdbms' => [
                'doctrine_dbal' => [
                    'connection' => $container->get(Connection::class),
                ],
            ],
        ],
        'generator' => [
            'identity' => [
                'service' => $container->get(SymfonyUuidIdentityGenerator::class),
                // or use ULIDs
                // 'service' => $container->get(SymfonyUlidIdentityGenerator::class),
            ],
        ],
        'registry' => [
            'event' => [
                'reflector' => [
                    'path' => '/path/to/src',
                    // default: getcwd() . '/../src'
                ],
            ],
            'command_handler' => [
                'reflector' => [
                    'path' => '/path/to/src',
                    // default: getcwd() . '/../src'
                ],
            ],
        ],
    ],
];
```

You can override any of these defaults however you like.

Required dependencies
---------------------

[](#required-dependencies)

Some of the required dependencies also need to be configured separately.

### Symfony Messenger (`symfony/messenger`)

[](#symfony-messenger-symfonymessenger)

The default configuration makes use of a service with name `event.bus`.

When this bus is configured, *Gember Event Sourcing* works out of the box. However, when a different event bus is preferred, it must be a service implementing `Symfony\Component\Messenger\MessageBusInterface`.

Example (minimum) configuration for [symfony/messenger](https://github.com/symfony/messenger):

**PSR-11 Container definition ():**

```
use Psr\Container\ContainerInterface;
use Symfony\Component\Messenger\Handler\HandlerDescriptor;
use Symfony\Component\Messenger\Handler\HandlersLocator;
use Symfony\Component\Messenger\MessageBus;
use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;

return [
    'event.bus' => fn(ContainerInterface $container) => new MessageBus([
        new HandleMessageMiddleware(new HandlersLocator([
            // Ideally this could be autoconfigured
            SomeDomainEvent::class => [
                new HandlerDescriptor([
                    $container->get(SomeProjector::class),
                    'onSomeDomainEvent'
                ]),
            ],
        ]), allowNoHandlers: true),
    ]),
];
```

### Symfony Cache (`symfony/cache`)

[](#symfony-cache-symfonycache)

The default configuration makes use of a service with name `cache.file`.

When this cache service is configured, *Gember Event Sourcing* works out of the box. However, when a different cache pool is preferred, it must be a service implementing `Psr\Cache\CacheItemPoolInterface` (PSR-6) or `Psr\SimpleCache\CacheInterface` (PSR-16).

Example (minimum) configuration for [symfony/cache](https://github.com/symfony/cache):

**PSR-11 Container definition ():**

```
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Psr16Cache;

return [
    'cache.file' => fn() => new Psr16Cache(new FilesystemAdapter(
        directory: __DIR__ . '/../../var/cache',
    )),
];
```

### Symfony Serializer (`symfony/serializer`)

[](#symfony-serializer-symfonyserializer)

The default configuration makes use of a service with name `Symfony\Component\Serializer\Serializer`.

When this serializer service is configured, *Gember Event Sourcing* works out of the box. However, when a different serializer is preferred, it must be a service implementing `Symfony\Component\Serializer\SerializerInterface`.

Example (minimum) configuration for [symfony/serializer](https://github.com/symfony/serializer):

**PSR-11 Container definition ():**

```
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;

return [
    Serializer::class => fn() => new Serializer([
        new DateTimeNormalizer([
            DateTimeNormalizer::FORMAT_KEY => 'Y-m-d\TH:i:s.uP',
        ]),
        new ObjectNormalizer(),
    ], [
        new JsonEncoder(),
    ]),
];
```

### Doctrine DBAL/ORM (`doctrine/dbal`, `doctrine/orm`)

[](#doctrine-dbalorm-doctrinedbal-doctrineorm)

The default configuration makes use of a service with name `Doctrine\DBAL\Connection`.

When this connection service is configured, *Gember Event Sourcing* works out of the box. However, when a different Doctrine connection is preferred, it must be a service implementing `Doctrine\DBAL\Connection`.

Example (minimum) configuration for [doctrine/dbal](https://github.com/doctrine/dbal):

**PSR-11 Container definition ():**

```
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;

return [
    Connection::class => fn() => DriverManager::getConnection([
        'host' => $_ENV['DB_HOST'],
        'port' => $_ENV['DB_PORT'],
        'dbname' => $_ENV['DB_DBNAME'],
        'user' => $_ENV['DB_USER'],
        'password' => $_ENV['DB_PASSWORD'],
        'driver' => $_ENV['DB_DRIVER'],
        'charset' => $_ENV['DB_CHARSET'],
    ]),
];
```

Database
--------

[](#database)

In order to persist all domain events in database, a running SQL database is needed. The event store requires two tables. Schema is available in either raw SQL or in a migration file format:

Raw SQL schema:

Migrations:

- Doctrine migrations:
- Phinx migrations:

Good to go!
-----------

[](#good-to-go)

Check the main package [gember/event-sourcing](https://github.com/GemberPHP/event-sourcing) or the demo application [gember/example-event-sourcing-dcb](https://github.com/GemberPHP/example-event-sourcing-dcb) for examples.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance72

Regular maintenance activity

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% 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 ~14 days

Recently: every ~3 days

Total

10

Last Release

242d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f5fda898ea5700962c462ce21749b844fa13a9b239bfb52c95926a90d07c0ef5?d=identicon)[jerowork](/maintainers/jerowork)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (32 commits)")[![jerowork](https://avatars.githubusercontent.com/u/4119451?v=4)](https://github.com/jerowork "jerowork (24 commits)")

---

Tags

container-interopcqrsdcbddddomain-driven-designdynamic-consistency-boundaryevent-sourcinggemberservice-providercontainer-interopservice providerDomain Driven Designdddevent sourcingdcbgemberdynamic-consistency-boundary

###  Code Quality

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/gember-event-sourcing-universal-service-provider/health.svg)

```
[![Health](https://phpackages.com/badges/gember-event-sourcing-universal-service-provider/health.svg)](https://phpackages.com/packages/gember-event-sourcing-universal-service-provider)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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