summaryrefslogtreecommitdiff
path: root/includes/application.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2018-09-02 16:55:35 +0200
committerGitHub <noreply@github.com>2018-09-02 16:55:35 +0200
commita103bc06e28f5eca6ba9c28c81ae1227d689f224 (patch)
tree759d675b621eed86b20f14abe448e83fa8d22562 /includes/application.php
parentbd8ceda6830f97247b73932b85ce41af5b8d2ab0 (diff)
parent2bebbeb1919e1d370ac5c0668e0db5ea63e73292 (diff)
Merge pull request #452 from MyIgel/rebuild-database
Rebuild database
Diffstat (limited to 'includes/application.php')
-rw-r--r--includes/application.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/includes/application.php b/includes/application.php
new file mode 100644
index 00000000..418dd08d
--- /dev/null
+++ b/includes/application.php
@@ -0,0 +1,37 @@
+<?php
+
+use Engelsystem\Application;
+use Engelsystem\Config\Config;
+use Engelsystem\Exceptions\Handler;
+use Engelsystem\Exceptions\Handlers\HandlerInterface;
+
+
+/**
+ * Include the autoloader
+ */
+require_once __DIR__ . '/autoload.php';
+
+
+/**
+ * Initialize and bootstrap the application
+ */
+$app = new Application(realpath(__DIR__ . DIRECTORY_SEPARATOR . '..'));
+$appConfig = $app->make(Config::class);
+$appConfig->set(require config_path('app.php'));
+$app->bootstrap($appConfig);
+
+
+/**
+ * Configure application
+ */
+date_default_timezone_set($app->get('config')->get('timezone'));
+
+if (config('environment') == 'development') {
+ $errorHandler = $app->get('error.handler');
+ $errorHandler->setEnvironment(Handler::ENV_DEVELOPMENT);
+ $app->bind(HandlerInterface::class, 'error.handler.development');
+ ini_set('display_errors', true);
+ error_reporting(E_ALL);
+} else {
+ ini_set('display_errors', false);
+}