10 ms·
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.
by fidz 13y ago
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.
- jmathai 13y agoNot 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 https://github.com/jmathai/epiphany [2] https://github.com/jmathai/epiphany/blob/master/examples/regex-route/index.php https://github.com/jmathai/epiphany/blob/master/examples/reg... [3] https://trovebox.com/blog/building-trovebox-entirely-using-our-api/ https://trovebox.com/blog/building-trovebox-entirely-using-o...
- fidz 13y agoIt 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.php#L171 https://github.com/jmathai/epiphany/blob/master/src/EpiRoute... [1]: http://en.wikipedia.org/wiki/Shunting-yard_algorithm http://en.wikipedia.org/wiki/Shunting-yard_algorithm [2]: http://blog.bigbinary.com/2013/01/29/journey-into-rails-routing.html http://blog.bigbinary.com/2013/01/29/journey-into-rails-rout...