Re:Macaw - A Simple PHP Router
by fidz on Sunday December 29, 2013 @12:25AM
(#6978531)
Is there any pattern matching router in PHP? Just like Journey on Rails. It is faster to use Patrern Matching than sequential brute force route.
[ Parent
| on HN ]
Not just a router but Epiphany[1] lets you specify a regex for routes[2]. My favorite part though is the API module which I blogged about a while back[3].
[1] https://github.com/jmathai/epiphany
[2] https://github.com/jmathai/epiphany/blob/master/examples/reg...
[3] https://trovebox.com/blog/building-trovebox-entirely-using-o...
It still use sequential matching[0]. What i meant is something like AST implementation in routing algorithm, which is obviously faster than sequential algorithm [1] [2]
[0]: https://github.com/jmathai/epiphany/blob/master/src/EpiRoute...
[1]: http://en.wikipedia.org/wiki/Shunting-yard_algorithm
[2]: http://blog.bigbinary.com/2013/01/29/journey-into-rails-rout...