-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
43 lines (35 loc) · 1.64 KB
/
index.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
<?php
/**
* @author Pierre-Henry Soria <[email protected]>
* @copyright (c) 2018, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; <https://www.gnu.org/licenses/gpl-3.0.en.html>
*/
declare(strict_types=1);
namespace Lifyzer;
use Dotenv\Dotenv;
use Lifyzer\Server\Core\Container\Container;
use Lifyzer\Server\Core\Container\Provider\Database as DatabaseContainer;
use Lifyzer\Server\Core\Container\Provider\HttpRequest as HttpRequestContainer;
use Lifyzer\Server\Core\Container\Provider\Monolog as MonologContainer;
use Lifyzer\Server\Core\Container\Provider\SwiftMailer as SwiftMailerContainer;
use Lifyzer\Server\Core\Container\Provider\Twig as TwigContainer;
use Lifyzer\Server\Core\Debug;
use Lifyzer\Server\Core\Uri\Router;
use Whoops\Handler\PrettyPageHandler;
require __DIR__ . '/Server/vendor/autoload.php';
(new Dotenv(__DIR__ . '/Server/config'))->load();
define('SITE_NAME', getenv('SITE_NAME'));
define('SITE_URL', getenv('SITE_URL'));
Debug::initializeMode();
$whoops = new \Whoops\Run;
$whoops->pushHandler(new PrettyPageHandler);
$whoops->register();
$container = new Container();
$container->register(TwigContainer::class, new TwigContainer());
$container->register(DatabaseContainer::class, new DatabaseContainer());
$container->register(HttpRequestContainer::class, new HttpRequestContainer());
$container->register(SwiftMailerContainer::class, new SwiftMailerContainer());
$container->register(MonologContainer::class, new MonologContainer(getenv('LOGGING_CHANNEL')));
$dispatcher = require __DIR__ . '/Server/config/routes.php';
$router = new Router($dispatcher, $container);
$router->dispatch();