PHPackages                             league/tactician-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. league/tactician-doctrine

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

league/tactician-doctrine
=========================

Plugins for Tactician commands using Doctrine, like wrapping every command in a transaction

v1.2.0(4y ago)583.1M↓61.5%16[1 issues](https://github.com/thephpleague/tactician-doctrine/issues)[2 PRs](https://github.com/thephpleague/tactician-doctrine/pulls)9MITPHPPHP &gt;=7.1CI failing

Since Feb 27Pushed 4y ago7 watchersCompare

[ Source](https://github.com/thephpleague/tactician-doctrine)[ Packagist](https://packagist.org/packages/league/tactician-doctrine)[ Docs](https://github.com/thephpleague/tactician-doctrine)[ RSS](/packages/league-tactician-doctrine/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (7)Versions (15)Used By (9)

tactician-doctrine
==================

[](#tactician-doctrine)

[![Latest Version](https://camo.githubusercontent.com/7ccfe021caf7d4ebe094e3059856323750f3e0fb3a2c86591e28c469444aae05/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7468657068706c65616775652f74616374696369616e2d646f637472696e652e7376673f7374796c653d666c61742d737175617265)](https://github.com/thephpleague/tactician-doctrine/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/1631fd5ff6913567e8f3edb0d3d86447f5e530a39734067b5546649a0a07c327/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7468657068706c65616775652f74616374696369616e2d646f637472696e652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/thephpleague/tactician-doctrine)[![Quality Score](https://camo.githubusercontent.com/994f5e0ef1dbd67560fee2315eff27f5340623417f9ce77b17f406940107889b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7468657068706c65616775652f74616374696369616e2d646f637472696e652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/thephpleague/tactician-doctrine)[![Total Downloads](https://camo.githubusercontent.com/3c35be982f2567f581d467e2a4c31649b7c25d0a4b7b69bcdfe0b3cf3dec3d46/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c65616775652f74616374696369616e2d646f637472696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/league/tactician-doctrine)

This package adds plugins for using Tactician with Doctrine components, either the ORM or just DBAL. The main feature is the ability to wrap each command in a separate database transaction.

Setup
-----

[](#setup)

Via Composer

```
$ composer require league/tactician-doctrine
```

Next, add the `ORM\TransactionMiddleware` to your CommandBus:

```
$commandBus = new \League\Tactician\CommandBus(
    [
        new TransactionMiddleware($ormEntityManager)
    ]
);
```

That's it. Each command you execute will now open and close a new transaction.

If a command fires off more commands, be aware that those commands will run in the same transaction as the parent. It is recommended that you run each command as a separate transaction, so to prevent this from happening, use the [`LockingMiddleware` that ships in Tactician core](http://tactician.thephpleague.com/plugins/locking-middleware/). This will queue the commands up internally until the parent command has completed.

If an exception is raised while handling the command, the transaction is rolled back, the EntityManager closed, and the exception rethrown.

Symfony integration
-------------------

[](#symfony-integration)

When using the \[tactician-bundle\] (), don't forget to add the Doctrine middleware to your Symfony config:

```
tactician:
    commandbus:
        default:
            middleware:
             - tactician.middleware.locking
             - tactician.middleware.doctrine
             - tactician.middleware.command_handler

```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

Security
--------

[](#security)

Disclosure information can be found on [the main Tactician repo](https://github.com/thephpleague/tactician#security).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity55

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 71.9% 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 ~209 days

Recently: every ~539 days

Total

13

Last Release

1628d ago

Major Versions

v0.6.0 → v1.0.02015-12-31

PHP version history (2 changes)v0.1PHP &gt;=5.5

v1.2.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/08b3ff6fe26e7316ae1da92af62c040380ae6bb1056794d44c6151ac74240e54?d=identicon)[rosstuck](/maintainers/rosstuck)

---

Top Contributors

[![rosstuck](https://avatars.githubusercontent.com/u/146766?v=4)](https://github.com/rosstuck "rosstuck (41 commits)")[![boekkooi](https://avatars.githubusercontent.com/u/399895?v=4)](https://github.com/boekkooi "boekkooi (4 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (3 commits)")[![snapshotpl](https://avatars.githubusercontent.com/u/312655?v=4)](https://github.com/snapshotpl "snapshotpl (2 commits)")[![monteiro](https://avatars.githubusercontent.com/u/74459?v=4)](https://github.com/monteiro "monteiro (2 commits)")[![arnovr](https://avatars.githubusercontent.com/u/6443841?v=4)](https://github.com/arnovr "arnovr (1 commits)")[![cubanec](https://avatars.githubusercontent.com/u/5373336?v=4)](https://github.com/cubanec "cubanec (1 commits)")[![sagikazarmark](https://avatars.githubusercontent.com/u/1226384?v=4)](https://github.com/sagikazarmark "sagikazarmark (1 commits)")[![simPod](https://avatars.githubusercontent.com/u/327717?v=4)](https://github.com/simPod "simPod (1 commits)")[![mateuszsip](https://avatars.githubusercontent.com/u/1377075?v=4)](https://github.com/mateuszsip "mateuszsip (1 commits)")

---

Tags

doctrinecommand bustacticiantransactions

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/league-tactician-doctrine/health.svg)

```
[![Health](https://phpackages.com/badges/league-tactician-doctrine/health.svg)](https://phpackages.com/packages/league-tactician-doctrine)
```

###  Alternatives

[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4585.8M4](/packages/martin-georgiev-postgresql-for-doctrine)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8465.5M96](/packages/laravel-doctrine-orm)[flow-php/doctrine-dbal-bulk

Bulk inserts and updates for Doctrine DBAL

14385.8k4](/packages/flow-php-doctrine-dbal-bulk)[simple-bus/doctrine-orm-bridge

Doctrine ORM bridge for using command and event buses

292.1M9](/packages/simple-bus-doctrine-orm-bridge)

PHPackages © 2026

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