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(7mo ago)212.7k↓50%1BSD-3-ClausePHPPHP &gt;=8.1.0 &lt;8.6CI passing

Since Jul 22Pushed 2mo 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 1mo ago

READMEChangelog (10)Dependencies (17)Versions (15)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 97% of packages

Maintenance76

Regular maintenance activity

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 66.2% 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

220d 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] (139 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

[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[knplabs/doctrine-behaviors

Doctrine Behavior Traits

92212.7M64](/packages/knplabs-doctrine-behaviors)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58723.9M36](/packages/scienta-doctrine-json-functions)[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[doctrine/doctrine-orm-module

Laminas Module that provides Doctrine ORM functionality

4407.3M293](/packages/doctrine-doctrine-orm-module)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)

PHPackages © 2026

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