phplegends / routes
A package for work with routes in php
0.1.1
2020-05-27 02:00 UTC
Requires
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2026-02-16 17:52:29 UTC
README
#PHPLegends Routes
The PHPLegends\Routes is a package for easy routing for you app.
For hello world, you can try this:
include __DIR__ . '/vendor/autoload.php'; $router = new \PHPLegends\Routes\Router; $router->get('/', function () { return 'Hello World'; }); $page = isset($_GET['page']) ? $_GET['page'] : '/'; $dispatcher = new \PHPLegends\Routes\Dispatcher($page, $_SERVER['REQUEST_METHOD']); echo $router->dispatch($dispatcher);
Now, run php -s localhost:8000 in folder of your index.php