a segment is only static of variable (and not both), we can do an explode and switch to find the route.
To speed things up the poc generates a PHP script for finding the route. With opcode caching this works quite nicely in PHP7.
Check it out here: https://github.com/jasny/php-router-benchmark
What do you guys think? Am I onto something here?
I guess this wouldn't work if your url looks like /foo/bar-{arg1}-{arg2}? For example when they add both the id and slug to the path
Обсуждают сегодня