skipperbent / simple-php-router

Simple, fast and yet powerful PHP router that is easy to get integrated and in any project. Heavily inspired by the way Laravel handles routing, with both simplicity and expand-ability in mind.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Group with optional parameter in prefix not matching

SunflowerFuchs opened this issue · comments

A group with the prefix '/{required}/{optional?}' never matches, since the parameter replace in RouteGroup::matchRoute() only replaces required parameters.

$parsedPrefix = str_ireplace('{' . $parameter . '}', $value, $parsedPrefix);

Hello,
optional parameters in group routes are currently not possible.
I personally don't think that this would be a good feature, because it breaks your whole URL structure. But maby you can show me an example where it is usefull to imprement it and I change my oppinion.

~ Marius

Hello,
if you don't need this functionality anymore, please close your issue.

~ Marius

Sorry, i forgot to reply.
We solved it differently in our application now, so we don't need this feature.
And you're correct, implementing this would break the URL structure too much, so it's better this way.