nikic/fastroute

Fast request router for PHP

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 36 minutes ago
Added to GitGenius on September 12th, 2026
Created on February 16th, 2014
Open Issues & Pull Requests: 27 (+0)
GitHub issues: Enabled
Number of forks: 451
Total Stargazers: 5,268 (+0)
Total Subscribers: 174 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 38.1 hours
Mean response time: 21.5 days
90th percentile: 80.3 days
Tracked items: 11

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 6
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 595 days
Stale 30+ days: 6
Stale 90+ days: 5

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • enhancement (4)
  • wontfix (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

FastRoute is a fast request router for PHP that uses regular expression based routing to match HTTP requests to handlers.

The library solves the problem of efficiently mapping incoming HTTP requests to the appropriate handler code. It works by accepting route definitions through a callback function, where routes are specified with HTTP methods, URI patterns using placeholder syntax like {id} or {id:[0-9]+}, and associated handlers. The router supports optional route segments in trailing positions, route grouping with common prefixes including nested groups, and optional caching of the compiled routing data to avoid recomputation on each request. When dispatching a URI, the router returns a status code indicating whether a match was found, the method was not allowed, or no route matched.

FastRoute suits projects that need reliable request routing in PHP applications where performance matters. The library is agnostic about how you interpret handlers—they can be callbacks, controller class names, or any other data you wish to associate with routes. The caching mechanism is particularly valuable for production deployments, allowing you to pre-compile routing tables and load them from cache rather than rebuilding them on each request. The tool requires PHP 8.1 or newer.

The project maintains a focused scope on routing performance and correctness. Development activity shows consistent attention to the core routing logic without scope creep into framework concerns like middleware or response handling. The codebase demonstrates careful consideration of edge cases, such as the explicit restriction on capturing groups within placeholders and the limitation of optional segments to trailing positions only. The library's design reflects a philosophy of doing one thing well—providing fast, predictable request routing—rather than attempting to be a full-featured framework.