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

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

fredjuvaux/doctrine-orm-provider
================================

Doctrine ORM provider for Silex

2.0.x-dev(10y ago)05333[1 PRs](https://github.com/fredjuvaux/silex-orm-provider/pulls)1MITPHPPHP &gt;=5.5.9

Since May 31Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (2)Used By (1)

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/)
- 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 to the dependencies in your projects composer.json file:

```
"fredjuvaux/doctrine-orm-provider": "1.0.*@dev"
```

And update your dependencies:

```
php composer.phar update
```

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:fredjuvaux/silex-orm-provider.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:fredjuvaux/silex-orm-provider.git vendor/silex-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/fredjuvaux/silex-orm-provider/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:

```
