Eloquent ORM and Slim PHP

Composer.json

{
"require":{
"slim/slim":"^3.0",
"illuminate/database": "*"
}
}

Configuration

//configuration.php
use Illuminate\Database\Capsule\Manager as Capsule;
// Database information
$$settings['development'] = array(
    'driver' => 'mysql',
    'host' => '127.0.0.1',
    'database' => 'db_name',
    'username' => 'username',
    'password' => 'password',
    'collation' => 'utf8_general_ci',
    'prefix' => '',
    'charset'   => 'utf8'
);
$capsule = new Capsule;
$capsule->addConnection($settings['development']);	
$capsule->bootEloquent();
$capsule->setAsGlobal();

$conn = $capsule->connection();

Model Class (example : table categories )

//categories.php
use Illuminate\Database\Eloquent\Model as Model;
class Categories extends Model{
}

Implementation in Slim

//index.php
require 'vendor/autoload.php';
include_once 'configuration.php';
include_once 'categories.php';

$app = new \Slim\App();

$app->get('/categories', function () use ($app) {
    print_r( Categories::all() );
});

$app->run();