Using a non-Eloquent ORM in Laravel
Laravel's Eloquent ORM is easy-to-use and very efficient. However, there are many different PHP ORMs and we may decide we prefer another ORM. In this recipe, we'll install the RedBean ORM and use it for our data.
Getting ready
For this recipe, we'll be using the RedBean ORM. You'll need to download it from http://www.redbeanphp.com/manual/installing, and unzip the file. Then move the file rb.php
to the app/libraries
directory of your app.
How to do it...
To complete this recipe, follow these steps:
In the
composer.json
file, make our autoloader load ourlibraries
directory. Theautoload
section should look similar to this:"autoload": { "classmap": [ "app/commands", "app/controllers", "app/models", "app/database/migrations", "app/database/seeds", "app/tests/TestCase.php", "app/libraries" ], }
In the command prompt, dump our autoloader:
php composer.phar dump-autoload
In our
routes.php
file, we'll...