Writing a PHP 8.5 Router Faster Than FastRoute

When working on Safi, my custom minimal PHP microframework, I initially reached for nikic/fast-route. It’s a battle-tested library that defined modern PHP routing, and I’ve always admired Nikita Popov’s classic write-up on regex routing performance.

However, since Safi focuses on zero-overhead execution, I started wondering: Can I build a dedicated router for PHP 8.5+ that runs even faster?

What followed was an intense engineering evolution—from a failed data-structure experiment to deep micro-benchmarking, and ultimately to Wajha (chani/wajha).

Here is how Wajha evolved, the micro-benchmarks that shaped its design, an honest breakdown of where its speed comes from, and its performance across both synthetic and real-world benchmarks.

Continue reading Writing a PHP 8.5 Router Faster Than FastRoute