-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
37 lines (27 loc) · 900 Bytes
/
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
<?php
include_once('./src/ServiceLoader.php');
include_once('./src/Router.php');
include_once('./src/ClassLoader.php');
include_once('./src/Response/Response.php');
use App\Response\Response;
use App\ServiceLoader;
use App\Router;
use App\ClassLoader;
set_exception_handler(function($exception) {
Response::JsonResponse(
[
'message' => $exception->getMessage(),
'code' => $exception->getCode()
],
$exception->getCode()
)->response();
});
function dd(...$data){
die(json_encode($data));
}
date_default_timezone_set('Europe/Warsaw');
$classLoader = new ClassLoader();
$router = new Router($classLoader->load('App\Request\Request'), $classLoader, $classLoader->load('App\Manager\SecurityManager'));
$classLoader->addObject($router);
$controller = $router->resolve();
$controller['controller']->{$controller['method']}()->response();