PHPackages                             juliangut/slim-doctrine-middleware - 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. [Framework](/categories/framework)
4. /
5. juliangut/slim-doctrine-middleware

ActiveLibrary[Framework](/categories/framework)

juliangut/slim-doctrine-middleware
==================================

Slim Framework Doctrine middleware

0.3.2(10y ago)56856BSD-3-ClausePHPPHP &gt;=5.4

Since Apr 5Pushed 10y ago1 watchersCompare

[ Source](https://github.com/juliangut/slim-doctrine-middleware)[ Packagist](https://packagist.org/packages/juliangut/slim-doctrine-middleware)[ Docs](http://github.com/juliangut/slim-doctrine-middleware)[ RSS](/packages/juliangut-slim-doctrine-middleware/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

[![Latest Version](https://camo.githubusercontent.com/808e5fc45e931dabc24734d96214040edef37bd47fb0cbab542aef58ef3bba4d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f6a756c69616e6775742f736c696d2d646f637472696e652d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juliangut/slim-doctrine-middleware)[![License](https://camo.githubusercontent.com/15791276aba93a0cd5ded7482377fde75cfe233d37bdc6111b9dae48d8ad8b77/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a756c69616e6775742f736c696d2d646f637472696e652d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://github.com/juliangut/slim-doctrine-middleware/blob/master/LICENSE)

[![Build status](https://camo.githubusercontent.com/8248ed06ce5ffd98de9d8d3237dd3d7bd4e3651a3664e83ea8d412608d33f35c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a756c69616e6775742f736c696d2d646f637472696e652d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/juliangut/slim-doctrine-middleware)[![Code Quality](https://camo.githubusercontent.com/276a4c4b754e9f9f93f82fe30cfd8dee2a5ea6f8a51b73038d4add8d6293439f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6a756c69616e6775742f736c696d2d646f637472696e652d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/juliangut/slim-doctrine-middleware)[![Code Coverage](https://camo.githubusercontent.com/d3eae38faf20d12135d3cd832ffd39ea7992f5d5015b0e9c5d3ba0ba59c45813/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6a756c69616e6775742f736c696d2d646f637472696e652d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/juliangut/slim-doctrine-middleware)[![Total Downloads](https://camo.githubusercontent.com/7b600971a18eb49ad2a373507ff260b0bb4ea2505d13967f6b3ec3455cc9674c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a756c69616e6775742f736c696d2d646f637472696e652d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juliangut/slim-doctrine-middleware)

Juliangut Slim Framework Doctrine handler middleware
====================================================

[](#juliangut-slim-framework-doctrine-handler-middleware)

Doctrine handler middleware for Slim Framework.

> ### Slim3 version
>
> [](#slim3-version)
>
> Doctrine integration service for Slim3 can be found in its own repository [juliangut/slim-doctrine](https://github.com/juliangut/slim-doctrine)

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

[](#installation)

Best way to install is using [Composer](https://getcomposer.org/):

```
php composer.phar require juliangut/slim-doctrine-middleware

```

Then require\_once the autoload file:

```
require_once './vendor/autoload.php';
```

Usage
-----

[](#usage)

Just add as any other middleware.

```
use Slim\Slim;
use Jgut\Slim\Middleware\DoctrineMiddleware;

$app = new Slim();

...

$app->add(new DoctrineMiddleware());
```

### Configuration

[](#configuration)

There are two ways to configure Doctrine Middleware

First by using `doctrine` key in Slim application configuration

```
// Minimun configuration
$config = [
    'doctrine' => [
        'connection' => [
            'driver' => 'pdo_sqlite',
            'memory' => true,
        ],
        'annotation_paths' => ['path_to_entities_files'],
    ],
];

$app = new Slim($config);
$app->add(new DoctrineMiddleware());
```

Second way is assigning options directly to Doctrine Middleware

```
$app = new Slim();

$doctrineMiddleware = new DoctrineMiddleware();
$doctrineMiddleware->setOption(
    'connection',
    ['driver' => 'pdo_sqlite', 'memory' => true]
);
$doctrineMiddleware->setOption('annotation_paths', ['path_to_entities_files']);
$app->add($doctrineMiddleware);
```

### Available configurations

[](#available-configurations)

- `connection` array of PDO configurations
- `cache_driver` array with Doctrine cache configurations
    - `type` string representing cache type, `apc`, `xcache`, `memcache`, `redis` or `array`
    - `host` string representing caching daemon host, needed for `memcache` and `redis`, defaults to '127.0.0.1'
    - `port` string representing caching daemon port, optionally available for `memcache` (defaults to 11211) and `redis` (defaults to 6379)
- `proxy_path` path were Doctrine creates its proxy classes, defaults to /tmp
- `annotation_files` array of Doctrine annotations files
- `annotation_namespaces` array of Doctrine annotations namespaces
- `annotation_autoloaders` array of Doctrine annotations autoloader callables
- `annotation_paths` array of paths where to find annotated entity files
- `xml_paths` array of paths where to find XML entity mapping files
- `yaml_paths` array of paths where to find YAML entity mapping files
- `auto_generate_proxies` bool indicating whether Doctrine should auto-generate missing proxies (default: *true*)

#### Note:

[](#note)

`annotation_paths`, `xml_paths` or `yaml_paths` is needed by Doctrine to include a Metadata Driver

Contributing
------------

[](#contributing)

Found a bug or have a feature request? [Please open a new issue](https://github.com/juliangut/slim-doctrine-middleware/issues). Have a look at existing issues before

See file [CONTRIBUTING.md](https://github.com/juliangut/slim-doctrine-middleware/blob/master/CONTRIBUTING.md)

### Contributors

[](#contributors)

- [@fousheezy (John Foushee)](https://github.com/fousheezy)
- [@mcrauwel (Matthias Crauwels)](https://github.com/mcrauwel)
- [@mgersten (Micah Gersten)](https://github.com/mgersten)

License
-------

[](#license)

### Release under BSD-3-Clause License.

[](#release-under-bsd-3-clause-license)

See file [LICENSE](https://github.com/juliangut/slim-doctrine-middleware/blob/master/LICENSE) included with the source code for a copy of the license terms

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.1% 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 ~38 days

Total

5

Last Release

3909d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c50421f1ab4148354dc2dd5dcaba168656b17ea913b310d112deb39a6f73ca1?d=identicon)[juliangut](/maintainers/juliangut)

---

Top Contributors

[![juliangut](https://avatars.githubusercontent.com/u/1104131?v=4)](https://github.com/juliangut "juliangut (27 commits)")[![mgersten](https://avatars.githubusercontent.com/u/1270613?v=4)](https://github.com/mgersten "mgersten (3 commits)")[![foush](https://avatars.githubusercontent.com/u/708458?v=4)](https://github.com/foush "foush (1 commits)")

---

Tags

middlewareframeworkslimdoctrinehandler

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/juliangut-slim-doctrine-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/juliangut-slim-doctrine-middleware/health.svg)](https://phpackages.com/packages/juliangut-slim-doctrine-middleware)
```

###  Alternatives

[slim/csrf

Slim Framework 4 CSRF protection PSR-15 middleware

3512.1M94](/packages/slim-csrf)[slim/http-cache

Slim Framework HTTP cache middleware and service provider

1242.9M27](/packages/slim-http-cache)[davidepastore/slim-validation

A slim middleware for validation based on Respect/Validation

171223.7k3](/packages/davidepastore-slim-validation)[juliangut/slim-doctrine

Slim-Doctrine managers integration

153.7k](/packages/juliangut-slim-doctrine)[bnf/slim3-psr15

PSR-15 middleware support for Slim Framework v3

10177.0k5](/packages/bnf-slim3-psr15)[pavlakis/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

3691.9k3](/packages/pavlakis-slim-cli)

PHPackages © 2026

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