DASPRiD / Dash

Flexible PSR-7 compliant HTTP router
BSD 2-Clause "Simplified" License
29 stars 9 forks source link

Allow to match route name? #53

Closed bakura10 closed 9 years ago

bakura10 commented 9 years ago

Hi,

In my refactor of ZfrRest, I stumbled into an interesting case, and I'd like to know if Dash supports that. Basically, I want to be able to set a template based on a route name. For instance, if there is a "users" route that has a child route called "user", it will be possible to decide to render a template for "users/user".

However, for correctly resolving the file path and find the proper file name, I need to have the default controller (because it contains the namespace that is needed to resolve the file). What I'd like to do is being able to do that:

$params = $router->getRouteForPath('users/user');

Or something similar, and it would return all the info from config for a given path (its defaults values, constraints)...

Is this possible @DASPRiD ?

DASPRiD commented 9 years ago

I think your best bet for that would actually reading the config array. The config stuff itself is pretty much lost during the factory process.