-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
42 lines (36 loc) · 1.02 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
<?php
try {
// General Settings
session_start();
define('DEBUG', true);
ini_set('display_errors', DEBUG);
error_reporting(E_ALL);
/**
* Call the Psr4AutoloaderClass and load all namespaces in namespaces.php file
*/
(function () {
require 'components/Psr4AutoloaderClass.php';
$ns_list = require 'config/namespaces.php';
$loader = new app\components\Psr4AutoloaderClass();
$loader->register();
foreach ($ns_list as $item) {
$loader->addNamespace($item['namespace'], $item['path']);
}
})();
// Call the Router
$router = new app\core\Router(
require 'config/routes.php',
'app\\controllers\\',
'action',
'Controller'
);
if (!$router->run()) {
(new app\core\View())->run('error_pages/404');
}
} catch (Exception $e) {
if (DEBUG) {
echo "<pre style='color: red; font-size: 16px;'>" . $e . "</pre>";
} else {
(new app\core\View())->run('error_pages/500');
}
}