Skip to content

Instantly share code, notes, and snippets.

@freyandhy
Last active February 19, 2017 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freyandhy/1d8d080efc3ec149a8d7756648d09ab5 to your computer and use it in GitHub Desktop.
Save freyandhy/1d8d080efc3ec149a8d7756648d09ab5 to your computer and use it in GitHub Desktop.
<?php
session_start();
require __DIR__ . '/../vendor/autoload.php';
// Slim Configuration
$config = array(
'displayErrorDetails' => true,
'addContentLengthHeader' => false,
);
$app = new \Slim\App(['settings' => $config]);
// Get Dependency Injection Container
$container = $app->getContainer();
// Register Twig View Helper
$container['view'] = function($container){
$view = new \Slim\Views\Twig(__DIR__ . '/Views', [
'cache' => false,
'debug' => true
]);
// Add Extension
$view->addExtension(new \Slim\Views\TwigExtension(
$container->router,
$container->request->getUri()
));
return $view;
};
// Load Our Routes
require __DIR__ .'/routes.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment