PHPackages                             maurice2k/mezzio-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. maurice2k/mezzio-doctrine

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

maurice2k/mezzio-doctrine
=========================

Doctrine ORM integration for Mezzio/Laminas using abstract service factories

1.0.1(1mo ago)1271↓86.3%MITPHPPHP ^8.4

Since Apr 16Pushed 1mo agoCompare

[ Source](https://github.com/maurice2k/mezzio-doctrine)[ Packagist](https://packagist.org/packages/maurice2k/mezzio-doctrine)[ Docs](https://github.com/maurice2k/mezzio-doctrine)[ RSS](/packages/maurice2k-mezzio-doctrine/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

maurice2k/mezzio-doctrine
=========================

[](#maurice2kmezzio-doctrine)

Doctrine ORM integration for [Mezzio](https://docs.mezzio.dev/) (formerly Zend Expressive) using a Laminas-compatible abstract service factory.

This package provides a lightweight, convention-based approach to wire up Doctrine ORM services (`EntityManager`, `Connection`, `Configuration`, `Driver`, `EventManager`) through PSR-11 containers with a single `ConfigProvider`.

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

[](#installation)

```
composer require maurice2k/mezzio-doctrine
```

If you're using Laminas component installer, the `ConfigProvider` is registered automatically. Otherwise, add it to your `config/config.php`:

```
$aggregator = new ConfigAggregator([
    \Maurice2k\MezzioDoctrine\ConfigProvider::class,
    // ...
]);
```

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

[](#configuration)

Add a `doctrine` key to your application config (e.g. `config/autoload/doctrine.global.php`):

```
return [
    'doctrine' => [
        'connection' => [
            'orm_default' => [
                'params' => [
                    'driverClass' => \Doctrine\DBAL\Driver\PDO\MySQL\Driver::class,
                    'host'     => 'localhost',
                    'port'     => '3306',
                    'user'     => 'root',
                    'password' => '',
                    'dbname'   => 'mydb',
                ],
            ],
        ],
        'driver' => [
            'orm_default' => [
                'class'   => \Doctrine\Persistence\Mapping\Driver\MappingDriverChain::class,
                'drivers' => [
                    'App\\Entity' => [
                        'class' => \Doctrine\ORM\Mapping\Driver\AttributeDriver::class,
                        'paths' => [__DIR__ . '/../../src/App/Entity'],
                    ],
                ],
            ],
        ],
        'configuration' => [
            'orm_default' => [
                'proxy_dir'       => 'data/cache/DoctrineORMProxy',
                'proxy_namespace' => 'DoctrineORMProxy',
            ],
        ],
        'event_manager' => [
            'orm_default' => [
                'subscribers' => [],
                'listeners'   => [],
            ],
        ],
    ],
];
```

How it works
------------

[](#how-it-works)

The package registers a Laminas `AbstractFactoryInterface` (`DoctrineServiceFactory`) that intercepts service requests matching the pattern `doctrine..` and delegates to the appropriate factory:

CategoryFactoryProduces`configuration``ConfigurationFactory``Doctrine\ORM\Configuration``connection``ConnectionFactory``Doctrine\DBAL\Connection``driver``DriverFactory``MappingDriver``entity_manager``EntityManagerFactory``Doctrine\ORM\EntityManager``event_manager``EventManagerFactory``Doctrine\Common\EventManager`Default aliases are registered so you can inject `EntityManager::class`, `EntityManagerInterface::class`, or `Connection::class` directly.

Multiple connections
--------------------

[](#multiple-connections)

Use different keys to set up multiple connections:

```
'doctrine' => [
    'connection' => [
        'orm_default' => [ /* ... */ ],
        'orm_reporting' => [ /* ... */ ],
    ],
    // same for driver, configuration, entity_manager, event_manager
],
```

Then retrieve via `$container->get('doctrine.entity_manager.orm_reporting')`.

Requirements
------------

[](#requirements)

- PHP 8.4+
- Doctrine ORM 3.6+
- Doctrine DBAL 4.x
- Laminas ServiceManager 3.22+ or 4.x

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance89

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

54d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/945d142b12317e99aadc84c22b58ffe3074e2f76cecd77d5c00d4a197addabe2?d=identicon)[maurice2k](/maintainers/maurice2k)

---

Top Contributors

[![maurice2k](https://avatars.githubusercontent.com/u/53060?v=4)](https://github.com/maurice2k "maurice2k (1 commits)")

---

Tags

PSR-11laminasormdoctrinemezzio

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/maurice2k-mezzio-doctrine/health.svg)

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

###  Alternatives

[doctrine/doctrine-orm-module

Laminas Module that provides Doctrine ORM functionality

4417.5M296](/packages/doctrine-doctrine-orm-module)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8455.5M96](/packages/laravel-doctrine-orm)[sulu/sulu

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

1.3k1.4M195](/packages/sulu-sulu)[scienta/doctrine-json-functions

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

58825.2M48](/packages/scienta-doctrine-json-functions)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

5.0k4.9k](/packages/shlinkio-shlink)[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.

1155.2k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

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