phplegends / routes
A package for work with routes in php
Installs: 73
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:package
Requires
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2024-11-16 15:07:15 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