PHPackages                             mzj/doctrine-orm-provider - 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. mzj/doctrine-orm-provider

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

mzj/doctrine-orm-provider
=========================

Doctrine ORM provider for Silex

08PHP

Since Sep 21Pushed 13y ago1 watchersCompare

[ Source](https://github.com/mzj/nutwerk-orm-extension)[ Packagist](https://packagist.org/packages/mzj/doctrine-orm-provider)[ RSS](/packages/mzj-doctrine-orm-provider/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Doctrine ORM Service Provider for Silex
=======================================

[](#doctrine-orm-service-provider-for-silex)

This extension sets up Doctrine ORM for Silex by reusing the database connection established with the DBAL extension (the default DoctrineServiceProvider included with Silex).

You'll find the following topics in this README:

- [Dependencies](#dependencies)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)

Dependencies
------------

[](#dependencies)

- [Silex](http://silex.sensiolabs.org/)*(Not mentioned in composer.json, because -in my opinion- it's a direct dependency of your own project, so you should put it in your own JSON-file.)*
- PHP 5.3.2 and above
- [Doctrine 2 Object Relational Mapper](https://github.com/doctrine/doctrine2)
- [Doctrine Database Abstraction Layer](https://github.com/doctrine/dbal)
- [Common library for Doctrine](https://github.com/doctrine/common)

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

[](#installation)

You basically have three options to add this extension to your Silex project. We'd strongly recommend the first option!

### composer.json

[](#composerjson)

Add 'nutwerk/doctrine-orm-provider' to the dependencies in your projects composer.json file and update your dependencies. This is by far the easiest way, since it automatically adds the Doctrine dependencies and adds everything to the autoloading mechanism supplied by Composer.

More information on Composer can be found on [getcomposer.org](http://getcomposer.org/).

### Git

[](#git)

Another option is to clone the project:

```
cd /path/to/your_project/vendor
git clone git@github.com:mjakubowski/nutwerk-orm-extension.git
```

Or you can add it as a submodule if your project is in a git repository too:

```
cd /path/to/your_project
git submodule add git@github.com:mjakubowski/nutwerk-orm-extension.git vendor/nutwerk-orm-extension
```

This will require you to manually install all the dependencies. Also note that you'll need to add the provider to the Silex autoloader (or whatever autoloading mechanism) by hand. More on both subjects can be found below.

### Download an archive

[](#download-an-archive)

GitHub also gives you the option to [download an ZIP-archive](https://github.com/mjakubowski/nutwerk-orm-extension/zipball/master), which you can extract in your vendor folder. This method will also require you to manually install all the dependencies and add everything to your autoloader.

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

[](#configuration)

First of all you should have the Doctrine DBAL connection configured. For more information about configuring the DoctrineServiceProvider, I'd recommend reading [this page of the Silex documentation](http://silex.sensiolabs.org/doc/providers/doctrine.html).

Registering the Doctrine ORM Service Provider is rather straight forward:

```
