The Router Component
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
src
tests
.gitattributes
.gitignore
.scrutinizer.yml
.travis.yml
LICENSE
README.md
composer.json
phpunit.xml.dist

README.md

Router

Build Status Code Coverage Scrutinizer Code Quality SensioLabsInsight

The Router Component.

Example

<?php

use miBadger/Router/Router;

/**
 * Create a new router.
 */
$router = new Router();

/**
 * Create a method route.
 */
$router->set('GET', '/method/', 'method');

/**
 * Create a class method route.
 */
$router->set('GET', '/class/', ['Class', 'method']);

/**
 * Create a closure route.
 */
$router->set('GET', '/closure/', function() {
	return 'result';
});

/**
 * Create a wildcard route.
 */
$router->set('GET', '/test/{wildcard}/', function($wildcard) {
	return $wildcard;
});

/**
 * Add multiple methods for a route.
 */
$router->set(['GET', 'POST', 'TEST'], '/route/', function() {
	return 'result';
});

/**
 * Resolve
 */
$router->resolve();