Created
December 10, 2014 20:00
-
-
Save malgorath/88154fa039e288809891 to your computer and use it in GitHub Desktop.
/public/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require '../vendor/autoload.php'; | |
require '../config.php'; | |
session_start(); | |
# initialize $app to contain slim framework | |
$app = new \Slim\Slim(); | |
# setup configurations for $app | |
$app->config('debug', true); | |
$app->config('mode', 'development'); | |
$app->container->singleton('twig', function ($c) { | |
$twig = new \Slim\Views\Twig(); | |
$twig->parserOptions = array( | |
'debug' => true, | |
'cache' => '../cache' | |
); | |
$twig->parserExtensions = array( | |
new \Slim\Views\TwigExtension(), | |
new \Twig_Extension_Debug(), | |
); | |
$templatesPath = '../templates/'; | |
$twig->setTemplatesDirectory($templatesPath); | |
return $twig; | |
}); | |
$app->twig->getEnvironment()->addGlobal("session", $_SESSION); | |
# include all route files | |
$routers = glob('../routers/*.router.php'); | |
foreach ($routers as $router) { | |
require $router; | |
} | |
$app->session = $_SESSION; | |
# Run application website | |
$app->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment