The paramaters from the path are not available in the request to any of my middleware, and are only available in the callable at the end of the middleware chain as $args.
I was trying to add a content negotiation HAL middleware to my route /some/route/{id:number}, but there was no no way to get the ID defined in my route path out of the request without parsing it all myself again.
The vars get defined upon case FastRoute::FOUND: in the Dispatcher.
Adding the Route params to the Request's Query Params solves the issue and makes for a far more useful middleware stack. Also it means you could probably deprecate the $args argument and just use the Request itself.
I have forked a branch and will send a pull request. :-)
The paramaters from the path are not available in the request to any of my middleware, and are only available in the callable at the end of the middleware chain as
$args
.I was trying to add a content negotiation HAL middleware to my route
/some/route/{id:number}
, but there was no no way to get the ID defined in my route path out of the request without parsing it all myself again.The vars get defined upon
case FastRoute::FOUND:
in the Dispatcher.Adding the Route params to the Request's Query Params solves the issue and makes for a far more useful middleware stack. Also it means you could probably deprecate the
$args
argument and just use the Request itself.I have forked a branch and will send a pull request. :-)