Database, Illuminate, Laravel, Micro Framework, MVC, PHP

Quick Development: Slim Framework + Illuminate(Laravel)

Create a project folder and add a composer.json file in it and paste the following codes, and run composer install. You should have Slim Framework, Twig, Illuminate(Laravel) in the project folder.

    "name": "Quick Dev!",
    "require": {
        "php": ">=5.3.0",
        "slim/slim": "2.*",
        "slim/extras": "2.*",
        "twig/twig": "1.*",
        "illuminate/database": "*"
    "autoload": {
        "classmap": [

Add a index.php file in project folder and copy paste the following:


require 'vendor/autoload.php';

// Database information
$settings = array(
    'driver' => 'mysql',
    'host' => '',
    'database' => 'dbname',
    'username' => 'username',
    'password' => 'password',
    'collation' => 'utf8_general_ci',
    'prefix' => '',
    'charset' => 'utf8'

// Bootstrap Eloquent ORM
$container = new IlluminateContainerContainer;
$connFactory = new IlluminateDatabaseConnectorsConnectionFactory($container);
$conn = $connFactory->make($settings);
$resolver = new IlluminateDatabaseConnectionResolver();
$resolver->addConnection('default', $conn);

$app = new SlimSlim();

$app->get('/', function () {
    echo "<h1>Quick Dev!!</h1>";
    $articles = Article::all();
    echo $articles->toJson();


Create a folder named models in the project folder and add the following into a file named Article.php:


class Article extends IlluminateDatabaseEloquentModel


Don’t forget our .htaccess file in a project folder. 🙂

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

Now you can navigate to your system, for example: http://localhost/quick-dev

p/s: You can use Twig later on. 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *

fourteen − 2 =