PHPackages                             jurosh/laravel-doctrine-forked - 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. jurosh/laravel-doctrine-forked

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

jurosh/laravel-doctrine-forked
==============================

The Doctrine 2 implementation that melts with Laravel 5

0.5.0(11y ago)013MITPHPPHP &gt;=5.5.0

Since Mar 25Pushed 10y ago1 watchersCompare

[ Source](https://github.com/jurosh/laravel-doctrine)[ Packagist](https://packagist.org/packages/jurosh/laravel-doctrine-forked)[ RSS](/packages/jurosh-laravel-doctrine-forked/feed)WikiDiscussions l5 Synced 1mo ago

READMEChangelogDependencies (5)Versions (23)Used By (0)

Doctrine 2 for Laravel 5
========================

[](#doctrine-2-for-laravel-5)

A **forked implementation of [laravel-doctrine](https://github.com/mitchellvanw/laravel-doctrine)** that melts with Laravel 5.

Documentation
-------------

[](#documentation)

As this is a **forked version** [the documentation](https://github.com/mitchellvanw/laravel-doctrine) still applies to most of the package. Please read [the original documentation](https://github.com/mitchellvanw/laravel-doctrine/wiki) and [README](https://github.com/mitchellvanw/laravel-doctrine) before using this fork.

Forked Changes, Improvements, and Functionality
-----------------------------------------------

[](#forked-changes-improvements-and-functionality)

1. [What's New?](#whats-new)
2. [Installation](#installation)
3. [Using different metadata drivers](#using-different-metadata-drivers)
4. [Using multiple entity managers](#using-multiple-entity-managers)
5. [Using DoctrineExtensions](#using-doctrineextensions)
6. [New Doctrine Configuration Reference](#new-doctrine-configuration-reference)
7. [Issues and Contributing](#issues-and-contributing)

What's New?
-----------

[](#whats-new)

**Fixes for Laravel 5 support**

- [Fixes for native auth functionality](https://github.com/mitchellvanw/laravel-doctrine/pull/100)
- [Loading correct contracts for `UserProvider`](https://github.com/mitchellvanw/laravel-doctrine/pull/102) (and [here](https://github.com/mitchellvanw/laravel-doctrine/pull/117) and [here](https://github.com/mitchellvanw/laravel-doctrine/pull/106))
- [Fixed service provider for l5 compatibility](https://github.com/mitchellvanw/laravel-doctrine/pull/113)
- [Missing use statement](https://github.com/mitchellvanw/laravel-doctrine/pull/110)

**New Functionality**

- [Support for multiple entity managers](https://github.com/mitchellvanw/laravel-doctrine/pull/55) so you can use different db connections (thanks [**npmarrin!**](https://github.com/npmarrin))
- [Support for standard and simple drivers (XML, YAML, or annotations)](https://github.com/FoxxMD/laravel-doctrine/pull/3) (thanks [**evopix!**](https://github.com/evopix))
- [Migrations and mapping conversion console commands](https://github.com/FoxxMD/laravel-doctrine/pull/4) (thanks [**evopix!**](https://github.com/evopix))
- Prefixes for sqlite config mapping
- Added cache:clear artisan commands
- **Backwards compatibility with all current doctrine configs using annotations**

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

[](#installation)

Begin by installing the package through Composer. Edit your project's `composer.json` to require `mitchellvanw/laravel-doctrine`.

```
"require": {
    "mitchellvanw/laravel-doctrine": "dev-l5",
    "doctrine/orm": "2.5.*@dev"
},
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/FoxxMD/laravel-doctrine.git"
    }
  ]
```

Next use Composer to update your project from the the Terminal:

```
php composer.phar update
```

**Caveats**

At the moment Doctrine\\ORM version 2.5 is still in beta. As a result the composer install may require you to change the `minimum-stability` in your `composer.json` to `dev`.

If you don't want to affect the stability of the rest of the packages, you can add the following property in your `composer.json`:

`"prefer-stable": true`

Once the package has been installed you'll need to add the service provider. Open your `app/config/app.php` configuration file, and add a new item to the `providers` array.

```
'Mitch\LaravelDoctrine\LaravelDoctrineServiceProvider'
```

After This you'll need to add the facade. Open your `app/config/app.php` configuration file, and add a new item to the `aliases` array.

```
'EntityManager' => 'Mitch\LaravelDoctrine\EntityManagerFacade',
'RegistryManager' => 'Mitch\LaravelDoctrine\RegistryManagerFacade'
```

It's recommended to publish the package configuration.

```
php artisan config:publish mitchellvanw/laravel-doctrine --path=vendor/mitchellvanw/laravel-doctrine/config
```

\##Using different metadata drivers

Doctrine provides [several drivers](https://doctrine-orm.readthedocs.org/en/latest/reference/metadata-drivers.html) that can be used to map table information to entity classes. For more information see [sections 19, 20, and 21 of the doctrine reference guide](https://doctrine-orm.readthedocs.org/en/latest/index.html#reference-guide).

**A default doctrine config will use the annotation driver. This is the way laravel-doctrine works out of the box. If this is all you need you can continue to use the documentation provided by [laravel-doctrine's wiki](https://github.com/mitchellvanw/laravel-doctrine/wiki/Doctrine-Configuration).**

To use a different driver edit the `metadata` property of the entity manager you want to use the driver with (in `doctrine.config`)

```
'entity_managers' => [
    'default' => [
        ...
        'metadata' => [
            'simple' => false,
            'driver' => 'yaml', //xml or yaml or annotation (ANNOTATION IS DEFAULT)
            'paths' => [
                base_path('app/Models/mappings') //all base paths to mapping directories go here
            ],
            'extension' => '.dcm.yml' //extension for mapping files if not using simple driver
        ],
    ],
  ]

```

Refer to the doctrine reference guide on how to set up each driver.

\##Using multiple entity managers

If you use the regular `EntityManager` facade you will receive the `default` EM defined in your doctrine config. To use multiple entity managers

- Use the `RegistryManager` facade or
- Inject `ManagerRegistry` into your controller

**Using the facade**

```
use RegistryManager;
public function __construct()
{
    parent::__construct();
    $this->_em = RegistryManager::getManager('tracking'); //gets 'tracking' EM
    $this->_em = RegistryManager::getManager(); //gets 'default' EM

    $this->inventoryRepo = $this->_em->getRepository('app\Models\Inventory');
}

```

**Using DI**

```
public function __construct(ManagerRegistry $reg)
{
    parent::__construct();
    $this->_em = $reg->getManager('tracking'); //gets 'tracking' EM
    $this->_em = $reg->getManager(); //gets 'default' EM

    $this->inventoryRepo = $this->_em->getRepository('app\Models\Inventory');
}

```

Using DoctrineExtensions
------------------------

[](#using-doctrineextensions)

[DoctrineExtensions](https://github.com/beberlei/DoctrineExtensions) is a set of extensions to Doctrine 2 that add support for additional query functions available in MySQL and Oracle. To learn more about what additional functionality is added visit [the package's github page](https://github.com/beberlei/DoctrineExtensions).

To use DoctrineExtensions install the package with composer:

```
composer require beberlei/DoctrineExtensions

```

Configuring extensions is easy and follows the pattern used by [DoctrineExtensions in its own config](https://github.com/beberlei/DoctrineExtensions/blob/master/config/mysql.yml). In your doctrine config simply add a `dql` array to every entity manager you want extensions accessible from or add the array to the top-level of your configuration to have it applied to all entity managers.

```
'dql' => [
    'numeric_functions' => [
        'ROUND' => 'DoctrineExtensions\Query\Mysql\Round',
        'POWER' => 'DoctrineExtensions\Query\Mysql\Power'
        ...
    ],
    'string_functions' => [
        'REPLACE' => 'DoctrineExtensions\Query\Mysql\Replace'
        ...
    ],
    'datetime_functions' => [
        'DATE' => 'DoctrineExtensions\Query\Mysql\Date'
        ...
    ]
]

```

That's it! Use DoctrineExtensions as you normally would.

New Doctrine Configuration Reference
------------------------------------

[](#new-doctrine-configuration-reference)

A complete sample of doctrine configuration taking advantage of all new functionality, with comments.

```
return [
    'default_connection' => 'default',
    'entity_managers' => [
        'default' => [ //MUST have an entity_managers entry for 'default'
            'connection' => 'rdsConnection',
            'cache_provider' => null,
            'repository' => 'Doctrine\ORM\EntityRepository',
            'logger' => null,
            'metadata' => [
                'simple' => false,
                'driver' => 'yaml', //xml or yaml or annotation (ANNOTATION IS DEFAULT)
                'paths' => [
                    base_path('app/Models/mappings') //all base paths to mapping directories go here
                ],
                'extension' => '.dcm.yml' //extension for mapping files if not using simple driver
            ],
            //Only usable if DoctrineExtensions is installed
            /*'dql' => [
                'numeric_functions' => [
                    'ROUND' => 'DoctrineExtensions\Query\Mysql\Round',
                    'POWER' => 'DoctrineExtensions\Query\Mysql\Power'
                    ...
                ],
                'string_functions' => [
                    'REPLACE' => 'DoctrineExtensions\Query\Mysql\Replace'
                    ...
                ],
                'datetime_functions' => [
                    'DATE' => 'DoctrineExtensions\Query\Mysql\Date'
                    ...
                ]
            ]*/
        ],
        'tracking' => [
            'connection' => 'trackingConnection',
            'cache_provider' => null,
            'repository' => 'Doctrine\ORM\EntityRepository',
            'simple_annotations' => false,
            'logger' => null,
            'metadata' => [
                'simple' => false,
                'driver' => 'annotation'
                //paths is not necessary for annotation
            ],
        ],
    ],
    'proxy' => [
        'auto_generate' => true, //create proxy files automatically (turn off for production)
        'directory' => base_path('storage/proxies'), //store them outside of default directory
        'namespace' => null
    ],
    //'cache_provider' => 'apc',
    //'logger' => new \Doctrine\DBAL\Logging\EchoSQLLogger()
    //'dql' => ...
];

```

\#Issues and Contributing

Issues?
-------

[](#issues)

If you have issues **related to changes made in this forked version** please open an issue **[on this repository](https://github.com/FoxxMD/laravel-doctrine/issues)**.

If your issue is general or related to functionality that exists in the original repo [please direct your questions there](https://github.com/mitchellvanw/laravel-doctrine/issues).

Contributing and Fork Status
----------------------------

[](#contributing-and-fork-status)

This fork **is not an official implementation of laravel-doctrine for Laravel 5** so I cannot gaurantee that it will continue to work or or be maintained in the future as Laravel changes, HOWEVER I use it on a daily basis with production code and so will keep it up to date as long as it is relevant for me.

I am happy to accept PRs and any other contributions from the community and will respond in a timely manner. I am open to accepting collaborators as well.

License
-------

[](#license)

This package is licensed under the [MIT license](https://github.com/mitchellvanw/laravel-doctrine/blob/master/LICENSE).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.7% 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 ~21 days

Recently: every ~48 days

Total

18

Last Release

4079d ago

PHP version history (2 changes)0.1PHP &gt;=5.4.0

0.5.0PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/d42ebe4139bb46b1f354bfb0a17f40a4adf5b6d52b9e475a753dc924ecc40613?d=identicon)[jurosh](/maintainers/jurosh)

---

Top Contributors

[![mitchellvanw](https://avatars.githubusercontent.com/u/3061428?v=4)](https://github.com/mitchellvanw "mitchellvanw (104 commits)")[![kirkbushell](https://avatars.githubusercontent.com/u/65171?v=4)](https://github.com/kirkbushell "kirkbushell (35 commits)")[![FoxxMD](https://avatars.githubusercontent.com/u/4663766?v=4)](https://github.com/FoxxMD "FoxxMD (21 commits)")[![evopix](https://avatars.githubusercontent.com/u/99371?v=4)](https://github.com/evopix "evopix (9 commits)")[![glennjacobs](https://avatars.githubusercontent.com/u/647407?v=4)](https://github.com/glennjacobs "glennjacobs (4 commits)")[![jurosh](https://avatars.githubusercontent.com/u/1630137?v=4)](https://github.com/jurosh "jurosh (4 commits)")[![npmarrin](https://avatars.githubusercontent.com/u/6911463?v=4)](https://github.com/npmarrin "npmarrin (4 commits)")[![Cosmicist](https://avatars.githubusercontent.com/u/1039580?v=4)](https://github.com/Cosmicist "Cosmicist (3 commits)")[![soyuka](https://avatars.githubusercontent.com/u/1321971?v=4)](https://github.com/soyuka "soyuka (2 commits)")[![bangipul](https://avatars.githubusercontent.com/u/6869523?v=4)](https://github.com/bangipul "bangipul (2 commits)")[![ldebrouwer](https://avatars.githubusercontent.com/u/913410?v=4)](https://github.com/ldebrouwer "ldebrouwer (2 commits)")[![abbajbryant](https://avatars.githubusercontent.com/u/427542?v=4)](https://github.com/abbajbryant "abbajbryant (1 commits)")[![leonardoalifraco](https://avatars.githubusercontent.com/u/2942943?v=4)](https://github.com/leonardoalifraco "leonardoalifraco (1 commits)")[![minorgod](https://avatars.githubusercontent.com/u/753184?v=4)](https://github.com/minorgod "minorgod (1 commits)")[![baileylo](https://avatars.githubusercontent.com/u/145345?v=4)](https://github.com/baileylo "baileylo (1 commits)")[![mrsimonbennett](https://avatars.githubusercontent.com/u/1471305?v=4)](https://github.com/mrsimonbennett "mrsimonbennett (1 commits)")[![adamwathan](https://avatars.githubusercontent.com/u/4323180?v=4)](https://github.com/adamwathan "adamwathan (1 commits)")[![oscaragcp](https://avatars.githubusercontent.com/u/6737981?v=4)](https://github.com/oscaragcp "oscaragcp (1 commits)")[![philipbrown](https://avatars.githubusercontent.com/u/1579059?v=4)](https://github.com/philipbrown "philipbrown (1 commits)")[![psampaz](https://avatars.githubusercontent.com/u/3634530?v=4)](https://github.com/psampaz "psampaz (1 commits)")

---

Tags

laravelormdoctrineDoctrine 2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jurosh-laravel-doctrine-forked/health.svg)

```
[![Health](https://phpackages.com/badges/jurosh-laravel-doctrine-forked/health.svg)](https://phpackages.com/packages/jurosh-laravel-doctrine-forked)
```

###  Alternatives

[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[scienta/doctrine-json-functions

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

58723.9M36](/packages/scienta-doctrine-json-functions)[laravel-doctrine/migrations

Doctrine Migrations for Laravel

782.8M16](/packages/laravel-doctrine-migrations)[laravel-doctrine/extensions

Doctrine extensions for Laravel

493.5M19](/packages/laravel-doctrine-extensions)[laravel-doctrine/acl

ACL for Laravel and Doctrine

44445.3k7](/packages/laravel-doctrine-acl)

PHPackages © 2026

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