From 6fb1cbaa6cd5dd57b815899b79fdf50f9c7852f0 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 28 Nov 2019 01:04:07 +0100 Subject: [PATCH] Add comments to index.php to make it easier to read --- index.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 3c6a151..b69d13d 100644 --- a/index.php +++ b/index.php @@ -21,32 +21,44 @@ if (is_file(__DIR__ . '/config/config.yml')) { Config::setFile(__DIR__ . '/config/config.yml'); } +// Create app. $app = new App(); $container = $app->getContainer(); + +// Load config. $config = Config::getInstance(); if ($config->uglyUrls) { $container['router'] = new UglyRouter(); } - 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(); } +// Locales. if (!class_exists('Locale')) { die('You need to install the intl extension for PHP.'); } $container['locale'] = LocaleManager::getInstance(); $app->add(new LocaleMiddleware($container)); +// Smarty. $container['view'] = ViewFactory::create($container); +// Controllers. $frontController = new FrontController($container); $jsonController = new JsonController($container); $downloadController = new DownloadController($container); +// Error handling. $container['errorHandler'] = [$frontController, 'error']; $container['phpErrorHandler'] = [$frontController, 'fatalError']; +// Routes. $app->get( '/', [$frontController, 'index']