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
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start 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