Add comments to index.php to make it easier to read
This commit is contained in:
parent
5c480f4268
commit
6fb1cbaa6c
1 changed files with 13 additions and 1 deletions
14
index.php
14
index.php
|
@ -21,32 +21,44 @@ if (is_file(__DIR__ . '/config/config.yml')) {
|
||||||
Config::setFile(__DIR__ . '/config/config.yml');
|
Config::setFile(__DIR__ . '/config/config.yml');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create app.
|
||||||
$app = new App();
|
$app = new App();
|
||||||
$container = $app->getContainer();
|
$container = $app->getContainer();
|
||||||
|
|
||||||
|
// Load config.
|
||||||
$config = Config::getInstance();
|
$config = Config::getInstance();
|
||||||
if ($config->uglyUrls) {
|
if ($config->uglyUrls) {
|
||||||
$container['router'] = new UglyRouter();
|
$container['router'] = new UglyRouter();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config->debug) {
|
if ($config->debug) {
|
||||||
|
/*
|
||||||
|
We want to enable this as soon as possible,
|
||||||
|
in order to catch errors that are thrown
|
||||||
|
before the Slim error handler is ready.
|
||||||
|
*/
|
||||||
Debug::enable();
|
Debug::enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Locales.
|
||||||
if (!class_exists('Locale')) {
|
if (!class_exists('Locale')) {
|
||||||
die('You need to install the intl extension for PHP.');
|
die('You need to install the intl extension for PHP.');
|
||||||
}
|
}
|
||||||
$container['locale'] = LocaleManager::getInstance();
|
$container['locale'] = LocaleManager::getInstance();
|
||||||
$app->add(new LocaleMiddleware($container));
|
$app->add(new LocaleMiddleware($container));
|
||||||
|
|
||||||
|
// Smarty.
|
||||||
$container['view'] = ViewFactory::create($container);
|
$container['view'] = ViewFactory::create($container);
|
||||||
|
|
||||||
|
// Controllers.
|
||||||
$frontController = new FrontController($container);
|
$frontController = new FrontController($container);
|
||||||
$jsonController = new JsonController($container);
|
$jsonController = new JsonController($container);
|
||||||
$downloadController = new DownloadController($container);
|
$downloadController = new DownloadController($container);
|
||||||
|
|
||||||
|
// Error handling.
|
||||||
$container['errorHandler'] = [$frontController, 'error'];
|
$container['errorHandler'] = [$frontController, 'error'];
|
||||||
$container['phpErrorHandler'] = [$frontController, 'fatalError'];
|
$container['phpErrorHandler'] = [$frontController, 'fatalError'];
|
||||||
|
|
||||||
|
// Routes.
|
||||||
$app->get(
|
$app->get(
|
||||||
'/',
|
'/',
|
||||||
[$frontController, 'index']
|
[$frontController, 'index']
|
||||||
|
|
Loading…
Reference in a new issue