Skip to content

Releases: nikic/FastRoute

FastRoute 0.4.0

08 Mar 18:12
Compare
Choose a tag to compare

This release adds support for registering a route for multiple HTTP methods at the same time, by passing an array for the method parameter of RouteCollector::addRoute(). For example:

/** @var RouteCollector $r */
$r->addRoute(['GET', 'POST'], '/foo/{bar}', 'handlerForGetAndPost');

// This is equivalent to:
$r->addRoute('GET', '/foo/{bar}', 'handlerForGetAndPost');
$r->addRoute('POST', '/foo/{bar}', 'handlerForGetAndPost');

FastRoute 0.3.0

26 Nov 19:19
Compare
Choose a tag to compare

This release fixes a routing bug, which could occur if two non-disjoint routes for different HTTP methods are defined:

$dispatcher = FastRoute\simpleDispatcher(function(FastRoute\RouteCollector $r) {
    $r->addRoute('GET',  '/user/{name}', 'GET with default placeholder pattern');
    $r->addRoute('POST', '/user/{name:[a-z]+}', 'POST with custom placeholder pattern');
});

A request to POST /user/foobar was previously rejected with 405 Method Not Supported and is now correctly matched.

For more information see #25.

This release changes the structure of the cached data (if cachedDispatcher is used), so the cache file should be removed after the update.