|
23 | 23 | /** |
24 | 24 | * Load BASE config first |
25 | 25 | */ |
26 | | -include __DIR__ . '/config/base.php'; |
| 26 | +require_once __DIR__ . '/config/base.php'; |
27 | 27 |
|
28 | 28 | /** |
29 | 29 | * Load AutoLoaders |
30 | 30 | */ |
31 | | -include __DIR__ . '/system/functions.php'; |
32 | | -include __DIR__ . '/system/autoload.php'; |
33 | | -include __DIR__ . '/vendor/autoload.php'; |
| 31 | +require_once __DIR__ . '/system/functions.php'; |
| 32 | +require_once __DIR__ . '/system/autoload.php'; |
| 33 | +require_once __DIR__ . '/vendor/autoload.php'; |
34 | 34 |
|
35 | 35 | /** |
36 | 36 | * Load Dependency Injector Container (PHP-DI) |
37 | 37 | */ |
38 | 38 | $container = DI\ContainerBuilder::buildDevContainer(); |
39 | 39 |
|
40 | 40 | /** |
41 | | - * Load System Configs |
| 41 | + * Load System Config |
42 | 42 | */ |
43 | | -include __DIR__ . '/config/system.php'; |
44 | | -include __DIR__ . '/config/cache.php'; |
45 | | -include __DIR__ . '/config/database.php'; |
46 | 43 | $config = $container->get('System\Config'); |
47 | 44 |
|
| 45 | +/** |
| 46 | + * Load System Logger |
| 47 | + */ |
| 48 | +$logger = $container->get('System\Logger'); |
| 49 | + |
48 | 50 | /** |
49 | 51 | * Load Cache Library (Stash) |
50 | 52 | */ |
51 | 53 | $cachedriver = new Stash\Driver\FileSystem(['path'=>$config->cache['stash']['cachedir']]); |
52 | 54 | $cache = new Stash\Pool($cachedriver); |
53 | 55 |
|
| 56 | + |
54 | 57 | /** |
55 | 58 | * Load Database |
56 | 59 | * Create a new PDO connection to MySQL |
57 | 60 | * Create a new static DB class object |
58 | 61 | */ |
59 | | -System\DB::$c = (new System\Database($config))->connect(); |
| 62 | +System\DB::$c = (new System\Database($container))->connect(); |
60 | 63 |
|
61 | 64 | /** |
62 | 65 | * Load System Language |
|
99 | 102 | /** |
100 | 103 | * Cache Routes |
101 | 104 | */ |
102 | | -if ($config->system['cache_routes']) { |
| 105 | +if ($config->system['cache_routes']) { |
103 | 106 | $item = $cache->getItem('routes'); |
104 | 107 | $routesData = $item->get(); |
105 | 108 | if ($item->isMiss()) { |
|
121 | 124 | /** |
122 | 125 | * Load Middlewares |
123 | 126 | */ |
124 | | -//Create a relay dispatcher and add some middlewares: |
125 | 127 | use Psr7Middlewares\Middleware; |
126 | 128 | $relay = new Relay\RelayBuilder(); |
127 | 129 |
|
| 130 | +//Create a relay dispatcher and add some middlewares |
128 | 131 | $relaydispatcher = $relay->newInstance([ |
129 | 132 | Middleware::basePath(BASE_PATH), |
130 | 133 | Middleware::trailingSlash(), |
131 | 134 | Middleware::responseTime(), |
132 | 135 | new System\Middlewares\LanguageDetect($language), |
133 | 136 | new System\Middlewares\Phroute($dispatcher) |
134 | 137 | ]); |
| 138 | + |
135 | 139 | $response = $relaydispatcher($request, $response); |
0 commit comments