-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
32 lines (26 loc) · 908 Bytes
/
bootstrap.php
File metadata and controls
32 lines (26 loc) · 908 Bytes
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
<?php
require '../vendor/autoload.php';
session_cache_limiter(false);
session_start();
$config = require '../config/config.php';
$app = new \Slim\App($config);
$container = $app->getContainer();
$container['db'] = function ($c) {
$db = $c['settings']['db'];
$pdo = new PDO('mysql:host=' . $db['host'] . ';dbname=' . $db['dbname'],
$db['user'], $db['pass']);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
return $pdo;
};
$container['auth'] = function ($container) {
return new AuthModel($container->db);
};
$container['view'] = new \Slim\Views\PhpRenderer('../view/');
// controllers
$container['TodoController'] = function ($container) {
return new TodoController($container);
};
$container['AuthController'] = function ($container) {
return new AuthController($container);
};