PHPackages                             nepada/message-bus-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. [Database &amp; ORM](/categories/database)
4. /
5. nepada/message-bus-doctrine

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

nepada/message-bus-doctrine
===========================

Doctrine ORM integration for nepada/message-bus

v2.3.3(10mo ago)213.4k↓49.6%1BSD-3-ClausePHPPHP &gt;=8.1.0 &lt;8.6CI passing

Since Jul 22Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/nepada/message-bus-doctrine)[ Packagist](https://packagist.org/packages/nepada/message-bus-doctrine)[ RSS](/packages/nepada-message-bus-doctrine/feed)WikiDiscussions master Synced 2w ago

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

Message Bus Doctrine ORM Extension
==================================

[](#message-bus-doctrine-orm-extension)

[![Build Status](https://github.com/nepada/message-bus-doctrine/workflows/CI/badge.svg)](https://github.com/nepada/message-bus-doctrine/actions?query=workflow%3ACI+branch%3Amaster)[![Coverage Status](https://camo.githubusercontent.com/2564ae03083bc139c5a6246e27286ae12a597eb40ee8ecb148641c2ef8899e3b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6e65706164612f6d6573736167652d6275732d646f637472696e652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/nepada/message-bus-doctrine?branch=master)[![Downloads this Month](https://camo.githubusercontent.com/471380f8f5a554c533e4ece8f619c21782902553ab95577e6c72743ea23a25e7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6e65706164612f6d6573736167652d6275732d646f637472696e652e737667)](https://packagist.org/packages/nepada/message-bus-doctrine)[![Latest stable](https://camo.githubusercontent.com/15cee84204da0fa922e4ce77db2f1e261285a56e25ae5642ac29d30e1e0d18f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e65706164612f6d6573736167652d6275732d646f637472696e652e737667)](https://packagist.org/packages/nepada/message-bus-doctrine)

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

[](#installation)

Via Composer:

```
$ composer require nepada/message-bus-doctrine
```

Usage
-----

[](#usage)

### Recording domain events inside entities

[](#recording-domain-events-inside-entities)

Make your entities implement `Nepada\MessageBusDoctrine\Events\ContainsRecordedEvents` (e.g. by using `Nepada\MessageBusDoctrine\Events\PrivateEventRecorder` trait) and record domain events inside the entities. The events will be automatically collected and dispatched on flush.

### Transaction handling

[](#transaction-handling)

`TransactionMiddleware` wraps the command handling into a database transaction. All changes made by lower layers are automatically flushed and commited, or rolled back on error.

It is highly recommended to use `PreventOuterTransactionMiddleware` to ensure there is no outer database transaction started outside of the message bus stack. Not doing so might lead to unwanted behavior such as dispatching and processing events before the changes made in command handler were actually persisted.

### Clearing entity manager

[](#clearing-entity-manager)

Use `ClearEntityManagerMiddleware` to clear entity manager before and/or after the message is handled. Note: Entity manager will not be cleared when inside active transaction, i.e. the middleware order is important.

Credits
-------

[](#credits)

Event recording idea and parts of its implementation are based on [simple-bus/doctrine-orm-bridge](https://github.com/SimpleBus/DoctrineORMBridge) by Matthias Noback, Cliff Odijk, Ruud Kamphuis.

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance75

Regular maintenance activity

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 67.3% 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 ~178 days

Total

11

Last Release

312d ago

PHP version history (6 changes)v2.0.0PHP &gt;=7.4.0

v2.1.1PHP &gt;=7.4.0 &lt;8.2

v2.1.2PHP &gt;=7.4.0 &lt;8.3

v2.2.0PHP &gt;=8.1.0 &lt;8.4

v2.3.1PHP &gt;=8.1.0 &lt;8.5

v2.3.3PHP &gt;=8.1.0 &lt;8.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b4780fe328102c4572737db639653c29d3081d1d3e051467f00d7f09a776399?d=identicon)[xificurk](/maintainers/xificurk)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (146 commits)")[![xificurk](https://avatars.githubusercontent.com/u/117465?v=4)](https://github.com/xificurk "xificurk (71 commits)")

---

Tags

doctrinemessage bus

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nepada-message-bus-doctrine/health.svg)

```
[![Health](https://phpackages.com/badges/nepada-message-bus-doctrine/health.svg)](https://phpackages.com/packages/nepada-message-bus-doctrine)
```

###  Alternatives

[pimcore/pimcore

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

3.8k3.9M535](/packages/pimcore-pimcore)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8405.6M99](/packages/laravel-doctrine-orm)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

12017.1k](/packages/rcsofttech-audit-trail-bundle)[sulu/sulu

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

1.3k1.4M236](/packages/sulu-sulu)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1617.3k16](/packages/2lenet-crudit-bundle)[api-platform/doctrine-orm

Doctrine ORM bridge

314.8M107](/packages/api-platform-doctrine-orm)

PHPackages © 2026

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