PHPackages                             liveecommerce/container-interop-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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. liveecommerce/container-interop-doctrine

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

liveecommerce/container-interop-doctrine
========================================

Doctrine factories for PSR-11

00PHP

Since Aug 23Pushed 2y agoCompare

[ Source](https://github.com/liveecommerce/container-interop-doctrine)[ Packagist](https://packagist.org/packages/liveecommerce/container-interop-doctrine)[ RSS](/packages/liveecommerce-container-interop-doctrine/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

container-interop-doctrine: Doctrine Factories for PSR-11
=========================================================

[](#container-interop-doctrine-doctrine-factories-for-psr-11)

THIS REPOSITORY IS DEPRECATED - PLEASE VISIT
==============================================================================================

[](#this-repository-is-deprecated---please-visit-httpsgithubcomroavepsr-container-doctrine)

[![Latest Stable Version](https://camo.githubusercontent.com/11d191a4d950f56439946ddf3d897449740d71edc72d4762f55af7ae229113d2/68747470733a2f2f706f7365722e707567782e6f72672f646173707269642f636f6e7461696e65722d696e7465726f702d646f637472696e652f762f737461626c65)](https://packagist.org/packages/dasprid/container-interop-doctrine)[![Total Downloads](https://camo.githubusercontent.com/11326578d8e031989eeb7cce40c261a57ba673f22621f6cf0ea63249732c95f8/68747470733a2f2f706f7365722e707567782e6f72672f646173707269642f636f6e7461696e65722d696e7465726f702d646f637472696e652f646f776e6c6f616473)](https://packagist.org/packages/dasprid/container-interop-doctrine)[![Build Status](https://camo.githubusercontent.com/8eee744090ace2128e0a4b029f4d9a88d43da586e283e0b391c2aa820ccee7e5/68747470733a2f2f6170692e7472617669732d63692e6f72672f444153505269442f636f6e7461696e65722d696e7465726f702d646f637472696e652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/DASPRiD/container-interop-doctrine)[![Coverage Status](https://camo.githubusercontent.com/45b23a152ee06f917d2ab15bf1664c1e336582c2e01699178099f36cf3cab4ba/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f444153505269442f636f6e7461696e65722d696e7465726f702d646f637472696e652f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/DASPRiD/container-interop-doctrine)

[Doctrine](https://github.com/doctrine) factories for [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md) (previously known as `container-interop`).

This package provides a set of factories to be used with containers using the PSR-11 standard for an easy Doctrine integration in a project.

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

[](#installation)

The easiest way to install this package is through composer:

```
$ composer require dasprid/container-interop-doctrine
```

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

[](#configuration)

In the general case where you are only using a single connection, it's enough to define the entity manager factory:

```
return [
    'dependencies' => [
        'factories' => [
            'doctrine.entity_manager.orm_default' => \ContainerInteropDoctrine\EntityManagerFactory::class,
        ],
    ],
];
```

If you want to add a second connection, or use another name than "orm\_default", you can do so by using the static variants of the factories:

```
return [
    'dependencies' => [
        'factories' => [
            'doctrine.entity_manager.orm_other' => [\ContainerInteropDoctrine\EntityManagerFactory::class, 'orm_other'],
        ],
    ],
];
```

Each factory supplied by this package will by default look for a registered factory in the container. If it cannot find one, it will automatically pull its dependencies from on-the-fly created factories. This saves you the hassle of registering factories in your container which you may not need at all. Of course, you can always register those factories when required. The following additional factories are available:

- `\ContainerInteropDoctrine\CacheFactory` (doctrine.cache.\*)
- `\ContainerInteropDoctrine\ConnectionFactory` (doctrine.connection.\*)
- `\ContainerInteropDoctrine\ConfigurationFactory` (doctrine.configuration.\*)
- `\ContainerInteropDoctrine\DriverFactory` (doctrine.driver.\*)
- `\ContainerInteropDoctrine\EventManagerFactory` (doctrine.event\_manager.\*)

Each of those factories supports the same static behavior as the entity manager factory. For container specific configurations, there are a few examples provided in the example directory:

- [Aura.Di](example/aura-di.php)
- [PimpleInterop](example/pimple-interop.php)
- [Laminas\\ServiceManager](example/laminas-servicemanager.php)

Example configuration
---------------------

[](#example-configuration)

A complete example configuration can be found in [example/full-config.php](example/full-config.php). Please note that the values in there are the defaults, and don't have to be supplied when you are not changing them. Keep your own configuration as minimal as possible. A minimal configuration can be found in [example/minimal-config.php](example/minimal-config.php)

Using the Doctrine CLI
----------------------

[](#using-the-doctrine-cli)

In order to be able to use the CLI tool of Doctrine, you need to set-up a `cli-config.php` file in your project directory. That file is generally quite short, and should look something like this for you:

```
