PHPackages                             sbooker/domain-events-persistence-doctrine - 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. sbooker/domain-events-persistence-doctrine

ActiveLibrary

sbooker/domain-events-persistence-doctrine
==========================================

Domain events storage Doctrine implementation

2.4.0(2w ago)04.5k1MITPHPPHP ^7.4 || ^8.0CI failing

Since Feb 2Pushed 2w ago1 watchersCompare

[ Source](https://github.com/sbooker/domain-events-persistence-doctrine)[ Packagist](https://packagist.org/packages/sbooker/domain-events-persistence-doctrine)[ RSS](/packages/sbooker-domain-events-persistence-doctrine/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (30)Versions (12)Used By (0)

[Read in English](README.EN.MD)

Doctrine Persistence for Domain Events (`sbooker/doctrine-domain-events-persistence`)
=====================================================================================

[](#doctrine-persistence-for-domain-events-sbookerdoctrine-domain-events-persistence)

[![Latest Version](https://camo.githubusercontent.com/954ae83db4c895cd53d54d43689a7b2e57f48687c3ba89d2d91827d8af1ef88f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73626f6f6b65722f646f6d61696e2d6576656e74732d70657273697374656e63652d646f637472696e652e7376673f7374796c653d666c61742d737175617265)](https://img.shields.io/packagist/v/sbooker/domain-events-persistence-doctrine)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/sbooker/domain-events-persistence-doctrine/blob/master/LICENSE)[![PHP Version](https://camo.githubusercontent.com/6fbf83d3129a571ede29101cf084d287fbe729e1e19a83e85cdde22a24bc6c2f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73626f6f6b65722f646f6d61696e2d6576656e74732d70657273697374656e63652d646f637472696e652e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Total Downloads](https://camo.githubusercontent.com/87df97e1eab85d9cbc9e87b1a9364d9b40003d29dc333bcadab9d6d38a201f17/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73626f6f6b65722f646f6d61696e2d6576656e74732d70657273697374656e63652d646f637472696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sbooker/domain-events-persistence-doctrine)

Готовая реализация хранилищ для [sbooker/domain-events-persistence](https://github.com/sbooker/domain-events-persistence) с использованием Doctrine ORM.

Назначение библиотеки
---------------------

[](#назначение-библиотеки)

Эта библиотека предоставляет единый, готовый к использованию Doctrine-репозиторий, который реализует **все интерфейсы хранения**, определенные в `sbooker/domain-events-persistence`:

- `ConsumeStorage`
- `SearchStorage`
- `CleanExpiredStorage`
- `IdentityStorage`

Использование этой библиотеки избавляет вас от необходимости писать собственную реализацию этих интерфейсов для Doctrine.

Установка
---------

[](#установка)

```
composer require sbooker/domain-events-persistence-doctrine
```

**Зависимости:**

- `sbooker/domain-events-persistence`
- `doctrine/orm`

Использование
-------------

[](#использование)

### Шаг 1: Настройте маппинг для `PersistentEvent`

[](#шаг-1-настройте-маппинг-для-persistentevent)

Вам необходимо сообщить Doctrine, как сохранять сущность `Sbooker\DomainEvents\Persistence\PersistentEvent` в базу данных.

Ниже приведен наиболее распространенный сценарий, где position является автоинкрементным первичным ключом.

**Пример маппинга (XML):**

```

                true

                true

```

**Важно:** Укажите `repository-class` в маппинге, чтобы Doctrine знала, что для этой сущности нужно использовать репозиторий из этой библиотеки.

### Шаг 2: Используйте репозиторий в DI-контейнере

[](#шаг-2-используйте-репозиторий-в-di-контейнере)

Теперь вы можете получить репозиторий из `EntityManager` и передать его в `ConsumerFactory` и другие сервисы, которым он нужен.

```
// bootstrap.php или ваш DI-контейнер

use Doctrine\ORM\EntityManagerInterface;
use Sbooker\DomainEvents\Persistence\ConsumerFactory;

/** @var EntityManagerInterface $entityManager */

// 1. Получаем наш готовый репозиторий из EntityManager
$persistentEventRepository = $entityManager->getRepository(\Sbooker\DomainEvents\Persistence\PersistentEvent::class);

// 2. Передаем его в ConsumerFactory и другие сервисы
$consumerFactory = new ConsumerFactory(
    $persistentEventRepository, // Реализует ConsumeStorage
    // ...
);

$myAuditService = new MyAuditService(
    $persistentEventRepository // Реализует SearchStorage
);
```

License
-------

[](#license)

See [LICENSE](https://github.com/sbooker/domain-events-persistence-doctrine/blob/master/LICENSE) file.

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance96

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 93.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 ~190 days

Recently: every ~378 days

Total

11

Last Release

20d ago

Major Versions

1.1.0 → 2.0.02021-05-03

### Community

Maintainers

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

---

Top Contributors

[![sbooker](https://avatars.githubusercontent.com/u/3658174?v=4)](https://github.com/sbooker "sbooker (15 commits)")[![s0lus](https://avatars.githubusercontent.com/u/4124371?v=4)](https://github.com/s0lus "s0lus (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sbooker-domain-events-persistence-doctrine/health.svg)

```
[![Health](https://phpackages.com/badges/sbooker-domain-events-persistence-doctrine/health.svg)](https://phpackages.com/packages/sbooker-domain-events-persistence-doctrine)
```

###  Alternatives

[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[api-platform/doctrine-orm

Doctrine ORM bridge

243.1M39](/packages/api-platform-doctrine-orm)[neos/flow-development-collection

Flow packages in a joined repository for pull requests.

144179.3k3](/packages/neos-flow-development-collection)[pixelfederation/doctrine-resettable-em-bundle

Symfony bundle for decorating default entity managers using a resettable decorator.

20113.5k](/packages/pixelfederation-doctrine-resettable-em-bundle)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)

PHPackages © 2026

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