-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbootstrap.php
46 lines (37 loc) · 1.01 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
session_start();
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
date_default_timezone_set('Asia/Dhaka');
define('APP_DIR', __DIR__ . DIRECTORY_SEPARATOR);
require 'vendor/autoload.php';
require_once APP_DIR . 'propel/generated-conf/config.php';
$app = new \Slim\App();
// Get container
$container = $app->getContainer();
// Register component on container
$container['view'] = function ($container) {
$view = new \Slim\Views\Twig(
APP_DIR . 'templates',
[
'cache' => APP_DIR . 'tmp/cache',
'debug' => true,
'auto_reload' => true,
]
);
$view->addExtension(
new \Slim\Views\TwigExtension(
$container['router'],
$container['request']->getUri()
)
);
$view->addExtension(
new Twig_Extension_Debug()
);
$view->offsetSet('userGlobalData' , App::getUser());
return $view;
};
// Register flash provider
$container['flash'] = function () {
return new \Slim\Flash\Messages();
};