Lassi\Lassi::bootstrap PHP Method

bootstrap() public static method

Bootstrap the framework
public static bootstrap ( ) : void
return void
    public static function bootstrap()
    {
        /* Load configuration from .dev.env | .dist.env | .env */
        Util::setEnvVariables(dirname(__FILE__) . '/..');
        /* Get instances */
        $lassi = static::getInstance();
        $slim = $lassi->getApp();
        /* Add base URL to all views for assets management */
        $slim->hook('slim.before', function () use($slim) {
            $slim->view()->appendData(array('baseUrl' => getenv('base_url')));
        });
        /* Load routes */
        static::loadRoutes();
        /* Run Slim framework */
        $slim->run();
    }

Usage Example

Beispiel #1
0
<?php

use Lassi\Lassi;
/**
 * Bootstrap the boilerplate
 *
 * @author Jabran Rafique <*****@*****.**>
 * @license MIT License
 */
/** Restrict direct access */
defined('ROOT') or die('Unexpected request');
/**
 * Setup Lassi with Slim framework and Eloquent
 */
Lassi::bootstrap();