overflowsith / slim-eloquent
Use Eloquent ORM in Slim 3
0.1.0
2015-11-30 16:43 UTC
Requires
- php: >=5.5.0
- illuminate/database: 5.1.*
This package is not auto-updated.
Last update: 2024-11-13 18:34:20 UTC
README
This is a light and dirty wrapper for using Eloquent ORM.
Usage
<?php require_once __DIR__ . '/vendor/autoload.php'; $app = new Slim\App(); $dbSettings = [ 'driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'database', 'username' => '', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ]; Overflowsith\SlimEloquent\Eloquent::boot($dbSettings); class User extends Overflowsith\SlimEloquent\Model { } $app->get('/', function ($request, $response, $args) use ($app) { $userCount = User::count(); $response->write("# of users: " . $userCount); return $response; }); $app->run(); ?>
Note
For a full documentations of Eloquent see http://laravel.com/docs/5.1/eloquent