Giter Site home page Giter Site logo

laravel-doctrine's Introduction

Laravel Doctrine

An ORM for a Framework for Web Artisans

Laravel's Eloquent ORM is nice 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 4.x as a composer package. Doctrine's EntityManager instance is accessible through a facade named Doctrine.

Metadata is currently obtained via the annotation driver.

Installation

Installation is the usual for Laravel packages.

Insert the following in the packages section of your composer.json file and run an update:

"atrauzzi/laravel-doctrine": "dev-master",

Add the service provider to your Laravel application in app/config/app.php. In the providers array add:

'Atrauzzi\LaravelDoctrine\ServiceProvider',

Then add the following to your facades array in the same file:

'Doctrine' => 'Atrauzzi\LaravelDoctrine\Support\Facades\Doctrine',

You'll likely want to configure the database connection, which you can do by overriding the bundle's defaults with the following command:

./artisan config:publish atrauzzi/laravel-doctrine

This should get you a fresh copy of the configuration file in the directory app/config/packages/vendor/atrauzzi/laravel-doctrine.

Usage

Most of Doctrine's functionality derives from defining your schema (via annotations in your model classes in this case), performing manipulations on instances and then persisting them through the EntityManager. You can obtain the EntityManager instance for your connection simply by using the Doctrine facade:

Adapted from Doctrine's documentation:

<?php
$user = new User;
$user->setName('Mr.Right');
Doctrine::persist($user);
Doctrine::flush();

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!

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!

laravel-doctrine's People

Contributors

atrauzzi avatar rjkip avatar tcampmany avatar kavinsky avatar codenamegary avatar echochamber avatar elijan avatar tnightingale avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.