https://github.com/cutplane1/u-router
https://github.com/cutplane1/u-router
php-library php-router php-routing router zero-dependency
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cutplane1/u-router
- Owner: cutplane1
- License: mit
- Created: 2023-07-01T18:01:10.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-06T15:21:12.000Z (over 1 year ago)
- Last Synced: 2025-05-27T13:56:33.278Z (about 1 year ago)
- Topics: php-library, php-router, php-routing, router, zero-dependency
- Language: PHP
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# u-router
```php
not_found(function() {
http_response_code(404);
echo "
404 Not Found
";
});
$router->middleware(function() {
header('Content-Type: application/json; charset=utf-8');
});
$router->get("/", function() {
echo json_encode(["hello" => "world"]);
});
$router->get("/", function($id) {
echo json_encode(["id" => $id]);
});
$router->dispatch();
```