-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
40 lines (33 loc) · 850 Bytes
/
index.php
File metadata and controls
40 lines (33 loc) · 850 Bytes
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
<?php
use Il4mb\Routing\Map\Route;
use Il4mb\Routing\Http\Method;
use Il4mb\Routing\Http\Request;
use Il4mb\Routing\Middlewares\Middleware;
use Il4mb\Routing\Router;
ini_set("log_errors", 1);
ini_set("error_log", "error.log");
require_once __DIR__ . "/vendor/autoload.php";
class Middle implements Middleware
{
function handle(Request $request, Closure $next)
{
}
}
class Controller
{
#[Route(Method::GET, "/{path.*}", middlewares: [Middle::class])]
function get($path, Closure $next)
{
return $next();
return ["From Get", $path];
}
#[Route(Method::GET, "/hallo/{world}")]
function get13($world)
{
return ["Halllo From Halaman " . $world];
}
}
$router = new Router();
$router->addRoute(new Controller());
$response = $router->dispatch(new Request());
echo $response->send();