colorium/routing

Colorium Routing Component

dev-master 2016-02-18 08:58 UTC

This package is not auto-updated.

Last update: 2024-11-07 02:24:35 UTC


README

use Colorium\Routing\Router;

// setup routes
$router = new Router;
$router->add('GET /hello/:name', function($name)
{
    echo 'Hello', $name, ' !';
});

// search route
$route = $router->find('GET /hello/you');

// if route not found
if(!$route) {
    // 404
}

// route details
$route->method; // 'GET'
$route->uri; // '/hello/:you'
$route->resource; // function($name) { ... }
$route->params; // ['name' => 'you']

Install

composer require colorium/routing