<?php // Slim deps use Slim\Slim; use Slim\Views\Twig; use Slim\Views\TwigExtension; // Config struff use Noodlehaus\Config; // Our dependencies use Fieldprotocol\Music\Album; use Fieldprotocol\Music\Song; // Let's get this session started session_cache_limiter(false); session_start(); // For now, display some errors ini_set('display_errors', 'On'); // The app's root directory define('INC_ROOT', dirname(__DIR__)); // Autoload our stuff >:D require INC_ROOT . '/vendor/autoload.php'; // Time to create our app $app = new Slim([ 'mode' => trim(file_get_contents(INC_ROOT . '/mode.php')), 'view' => new Twig(), 'templates.path' => INC_ROOT . '/app/views' ]); // Run some crap before the middleware //$app->add(new BeforeMiddleware); //$app->add(new CSRFMiddleware); $app->configureMode($app->config('mode'), function() use ($app) { $app->config = Config::load(INC_ROOT . "/app/config/{$app->mode}.php"); }); // Database configs require 'database.php'; // Filters require 'filters.php'; // Routes configs require 'routes.php'; //$app->auth = false; // Album singleton $app->container->set('album', function() { return new Album; }); // Song singleton $app->container->set('song', function() { return new Song; }); // Slappin' some hoes with our views $view = $app->view(); $view->parserOptions = [ 'debug' => $app->config->get('twig.debug') ]; $view->setTemplatesDirectory('../app/views'); $view->parserExtensions = [ new TwigExtension() ]; // Run Slim $app->run();