This library provides a fast implementation of a regular expression-based router. Firstly, while writing a PHP extension is obviously a lot of fun, it is unlikely to be particularly beneficial in terms of performance unless the code involves computations in tight loops. Porting “normal” components like routers to C is usually a big waste of time. You can get much better results by doing a few small improvements on the algorithmic side. For the same reason I’m not a big fan of things like Phalcon, i.e. PHP frameworks written as a C extension. You can get good performance by using an appropriate application design (that is not massively overengineered) and still retain the flexibility of keeping everything in PHP. A URI is dispatched by calling the dispatch() method of the created dispatcher. This method accepts the HTTP method and a URI. Getting those two bits of information (and normalizing them appropriately) is your job.

Features

  • The routes are defined by calling the FastRoute\simpleDispatcher() function
  • Custom patterns for route placeholders cannot use capturing groups
  • Shortcut methods for common request methods
  • You can specify routes inside of a group
  • Nested groups are also supported
  • The route parser can be overwritten individually (to make use of some different pattern syntax)

Project Samples

Project Activity

See All Activity >

Categories

Router

Follow FastRoute

FastRoute Web Site

Other Useful Business Software
Easily Host LLMs and Web Apps on Cloud Run Icon
Easily Host LLMs and Web Apps on Cloud Run

Run everything from popular models with on-demand NVIDIA L4 GPUs to web apps without infrastructure management.

Run frontend and backend services, batch jobs, host LLMs, and queue processing workloads without the need to manage infrastructure. Cloud Run gives you on-demand GPU access for hosting LLMs and running real-time AI—with 5-second cold starts and automatic scale-to-zero so you only pay for actual usage. New customers get $300 in free credit to start.
Try Cloud Run Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of FastRoute!

Additional Project Details

Programming Language

PHP

Related Categories

PHP Router Firmware

Registered

2021-12-03