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
Turn Your Content into Interactive Magic - For Free Icon
Turn Your Content into Interactive Magic - For Free

From Canva to Slides, Desmos to YouTube, Lumio works with the tech tools you are already using.

Transform anything you share into an engaging digital experience - for free. Instantly convert your PDFs, slides, and files into dynamic, interactive sessions with built-in collaboration tools, activities, and real-time assessment. From teaching to training to team building, make every presentation unforgettable. Used by millions for education, business, and professional development.
Start Free Forever
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