Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Fast Route Laravel Package

nikic/fast-route

FastRoute is a high-performance PHP 8.1+ request router using compiled regular expressions. Define routes with patterns and parameters (optional segments, constraints), dispatch by HTTP method and URI, and get NOT_FOUND, METHOD_NOT_ALLOWED, or FOUND with handler and vars.

View on GitHub
Deep Wiki
Context7
2.0.0-beta1

This is a pre-release of FastRoute containing all recent improvements. It's meant for enabling downstream testing, specially the detection of unexpected BC-breaks.

In the meantime we'll be updating the documentation and dealing with any undesired breakage.

Check all changes in https://github.com/nikic/FastRoute/milestone/1?closed=1

v1.3.0
  • Improve type usage in doc comments.
  • Switch coding style to PSR-2.
  • Mark shape keys in FastRoute.hhi as optional. This adds support for HHVM >= 3.23 and removes support for HHVM < 3.23.
v1.2.0
  • Added support for route groups.
  • Made some RouteCollector properties protected instead of private.
v1.1.0

Fixed

  • If the cacheDisabled option is enabled, the cache file is no longer written. Previously it was not read, but still written. (#114)

Added

  • Added convenience methods get(), post(), put(), delete(), patch() and head() to the RouteCollector. (#109)
v1.0.1

Placeholder names may now start with an underscore (_) character.

v1.0.0

This is a re-release of version 0.8.0 without code changes. Given the number of dependent projects there should be a formally stable release :)

v0.8.0
  • Fixed fallback from HEAD to GET if dynamic HEAD routes are defined.
  • First check all HEAD routes before attempting a GET fallback.
  • Add support for hyphens in placeholder names.
  • (Experimental.) Add support for fallback routes that match any method. These are specified using a * method and matched after all other routes.
v0.7.0
  • Add HHI file for Hack typechecking support. The HHI file requires HHVM 3.9 or newer.
  • Fix support for empty routes.
  • Improve error message if optional part is not at the end of a route.
v0.6.0

Added support for trailing optional segments, for example the route

$r->addRoute('GET', '/foo[/{bar}[/{baz}]]', 'handler');

is equivalent to the three routes

$r->addRoute('GET', '/foo', 'handler');
$r->addRoute('GET', '/foo/{bar}', 'handler');
$r->addRoute('GET', '/foo/{bar}/{baz}', 'handler');

As a result of this additional the output format for RouteParser was changed to add another array level, which may need to be accounted for if you use a custom parser.

v0.5.0
  • Fixed fallback of static routes to dynamic routes with different allowed HTTP methods. (#50)
  • Added routeCollector option to dispatcher functions. (#40)
  • The simpleDispatcher() and cachedDispatcher() functions will now only be defined if they do not yet exist, resolving some autoloading issues. (#39)
  • Capturing groups inside placeholder regular expressions will now be detected and explicitly forbidden. (#34)

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

v0.4.0

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](https://github.com/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');

v0.3.0

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4