About a year ago, I released a Doctrine2 provider for Laravel 4. We’ve just updated this as a new package for Laravel 5. Â Full details can be seen in the project’s README.md.
This package creates four bindings into Laravel’s IoC:
Doctrine\ORM\EntityManagerInterface
(which is an instance of Doctrine\ORM\EntityManager), also available via theD2EM
facade;Doctrine\Common\Cache\Cache
(which is an instance of the appropriate cache provider), also available via theD2Cache
facade;Doctrine\ORM\Mapping\ClassMetadataFactory
(used in this package by the console generator commands); and- the
Doctrine2Bridge\Support\Repository
helper object which used by theD2R
facade to instantiate repositories such asD2R::r( 'User' )
.
An example of using the D2Cache
and D2EM
D2Cache::save( $key, $value );
D2Cache::fetch( $key );
$object = new Entities\Object;
D2EM::persist( $object );
D2EM::flush();
It includes support for Laravel’s authentication system by way of a Doctrine2 based user provider with some example classes. Simply put – this allows a Doctrine2 database table storing users’ usernames and passwords to be used as the backend for Laravel 5 authentication.
Full documentation of the authentication with examples can be found here.