This repository was archived by the owner on Dec 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
41 lines (31 loc) · 1.3 KB
/
bootstrap.php
File metadata and controls
41 lines (31 loc) · 1.3 KB
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
<?php
$config = __DIR__ . '/config.php';
$autoload = __DIR__ . '/vendor/autoload.php';
// Check if config file is present. If not throw an error.
if (! stream_resolve_include_path($config)) {
throw new Exception('Config file ' . $config . ' not found! Create it from config.sample.php.');
}
// Check if depenedencies are installed. If not throw an error.
if (! stream_resolve_include_path($autoload)) {
throw new Exception('Composer generated file ' . $autoload . ' not found! Execute <code>composer install</code>.');
}
require_once $autoload;
require_once $config;
// Providing password_hash() and password_verify() in PHP <= 5.4
require_once __DIR__ . '/vendor/Antnee/phpPasswordHashingLib/passwordLib.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use ShoppingList\Router;
date_default_timezone_set('Europe/Zurich');
// init
$app = new Silex\Application();
$app['debug'] = $config['debug'];
$app['http_cache'] = $config['http_cache'];
$app['config'] = $config;
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
'db.options' => $config['database']
));
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__ . '/web/templates'
));
$app['twig']->addExtension(new Twig_Extensions_Extension_I18n());