Download the PHP package atrauzzi/laravel-doctrine without Composer
On this page you can find all versions of the php package atrauzzi/laravel-doctrine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-doctrine
Laravel Doctrine
This library is succeeded by laravel-doctrine/orm
Though this library is NOT abandoned a more feature-complete and up to date alternative is available at laravel-doctrine/orm. Check it out!
An ORM for a Framework for Web Artisans
Laravel's Eloquent ORM is excellent for lightweight use, however there's little out there that can beat Doctrine when you need a more full-featured ORM.
This is an integration of Doctrine 2.x to Laravel as a composer package. Doctrine's EntityManager
instance is accessible through a facade named Doctrine
as well as via dependency injection.
Metadata is obtained via the annotation driver or a custom config driver that leverages a Laravel-like configuration syntax.
Installation
Installation is the usual for Laravel packages.
Insert the following configs in your composer.json
:
In the packages section (require):
After that, just run a composer update
Add the service provider to your Laravel application in config/app.php
. In the providers
array add:
If desired, add the following to your facades
array in the same file:
You need to run this command publish package configuration.
php artisan vendor:publish --provider="Atrauzzi\LaravelDoctrine\ServiceProvider" --tag="config"
Usage
You can obtain the EntityManager
instance for your connection simply by using the Doctrine
facade:
Adapted from Doctrine's documentation:
Sample Entity in Laravel 5:
It is recommended that you read through all of the ORM documentation. Try using Laravel's console to experiment and go through the tutorials.
Enjoy!
Doctrine Console
If you need to run ORM commands it is necessary a cli-config.php
file at root project folder having the following implementation:
For validate your schema, you can do:
Authentication driver
This package allows you to customize the authentication driver using your own user model. In order to use doctrine authentication driver you need to keep in mind the following structure.
- Having user model representing an authenticatable user into your application
- Edit
/config/doctrine.php
config file to set authentication model and user provider - Edit
/config/auth.php
config file to set authentication driver.
Now, let's understand how this driver works.
User model
Your application must has a model implementing Illuminate\Contracts\Auth\Authenticatable
. By default, this package
comes with a Doctrine Authentication provider that works with a model using its email
and password
as unique valid
credentials. The code below shows a valid user model:
It is important to know that laravel needs that our model accomplishes with some rules provided by this interface:
- getAuthIdentifier()
- getRememberToken()
- setRememberToken($value)
- getRememberTokenName()
doctrine.php
Once you have created a valid user model, you are able to specify it in doctrine config file as below:
- If you want to base your authentication system by
email
andpassword
you can use the default doctrine authenticator. - If you need to implement your own doctrine authenticator then set
authenticator
key by passing the classname. - If you want to use the native laravel auth driver, then set
authenticator
key anull
value or just comment it.
auth.php
Finally, to set doctrine driver as default authentication system you need to set the value as doctrine.auth
:
License
The Laravel framework is open-sourced software license under the MIT license
This project is too to ensure maximum compatibility.
Meta
I'm interested in hearing feedback and suggestions about this package. Please feel free to submit a ticket at any time.
Visit laravel-doctrine:
laravel-doctrine is made by Alexander Trauzzi with help from all the people in contributors.md
!
All versions of laravel-doctrine with dependencies
illuminate/support Version 4.*
doctrine/orm Version 2.4.*
doctrine/migrations Version dev-master#46a031ddaea47d0685200027cfe8c83b02aee6f6