cutplane1 / u-router
Finished router.
1.3.2
2023-12-18 14:02 UTC
Requires
- php: >=7.4
README
<?php require "vendor/autoload.php"; $router = new Cutplane1\URouter(); $router->not_found(function() { http_response_code(404); echo "<h1>404 Not Found</h1>"; }); $router->middleware(function() { header('Content-Type: application/json; charset=utf-8'); }); $router->get("/", function() { echo json_encode(["hello" => "world"]); }); $router->get("/<int>", function($id) { echo json_encode(["id" => $id]); }); $router->dispatch();