nikic / FastRoute

Fast request router for PHP
Other
5.13k stars 445 forks source link

Url generator from args #235

Closed maximedotair closed 3 years ago

maximedotair commented 3 years ago

Hello,

i have this route : /examplecomplex/{numero}[/[{p1}/{v1}/[{p2}/{v2}/[{p3}/{v3}/[{p4}/{v4}/]]]]]

I want to generate the final url with args

$args['num'] = 010203 $args['p1'] = foo $args['p1'] = bar

result : /examplecomplex/010203/foo/bar/

It is possible with fastroute ? Thanks

lcobucci commented 3 years ago

@kwizfreak hey 👋

What you describe is essentially the "reverse routing" or "URL generation" that folks mentioned in https://github.com/nikic/FastRoute/issues/139 and https://github.com/nikic/FastRoute/issues/66.

We don't have that at the moment but are discussing the possibilities for the future. On the linked issues you have some ideas of what can be done until then 👍

lcobucci commented 3 years ago

Closing this as duplicate as per my comment, feel free to re-open if you need more info 😄

maximedotair commented 3 years ago

Thanks, btw i don't find a good solution with fastroute :(