phplegends / routes

A package for routting http in php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#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

About

A package for routting http in php

License:MIT License


Languages

Language:PHP 100.0%