igniphp / framework

Swoole, PSR-15, PSR-7, PSR-11 lightweight modular anti-framework for REST micro-services.
MIT License
265 stars 14 forks source link

Switch router to Symfony #3

Closed garak closed 6 years ago

garak commented 6 years ago

According to Symfony blog, its router is now faster than FastRoute. You should consider a change in your requirements. As alternative, you should remove mention to "fastest router" in README.

dkraczkowski commented 6 years ago

@garak I have started working on implementation (symfony_routing branch), but there is a problem - symfony router does not support optional parts :<. I am wondering whether it is worth supporting this feature. Any guess?

garak commented 6 years ago

I didn't try to use routing outside Symfony framework, but inside framework itself such option is present (so I guess it's possible somehow)

dkraczkowski commented 6 years ago

Could you please provide me equivalent of the following route: /some[/optional[/{route}]]

garak commented 6 years ago

See http://symfony.com/doc/current/routing/optional_placeholders.html

dkraczkowski commented 6 years ago

Have seen it, and it looks like you can have optional placeholders (if you define default values) but not optional parts of the route.

garak commented 6 years ago

I see. To fulfill your example, you need to define 2 routes

dkraczkowski commented 6 years ago

precisely! But if none is using this functionality maybe its worth switching to symfony-router.

dkraczkowski commented 6 years ago

https://github.com/igniphp/framework/pull/8

dkraczkowski commented 6 years ago

Fixed.