Allow route parameters to be injected directly as controller method arguments rather than requiring the $args array.
Current behaviour:
$router->map('GET', '/users/{id}', function (ServerRequestInterface $request, array $args) {
$id = $args['id'];
});
Proposed behaviour (via strategy or opt-in):
$router->map('GET', '/users/{id}', function (ServerRequestInterface $request, string $id) {
// $id injected directly
});
Considerations:
- Requires reflection to inspect controller signatures, which has performance overhead
- The
ServerRequestInterface injection should remain optional
- Should be implemented as a strategy concern, not in the routing core
- Edge cases around parameter naming mismatches, default values, and variadic parameters
- Could be a companion package rather than core feature
Target: 7.x
Allow route parameters to be injected directly as controller method arguments rather than requiring the
$argsarray.Current behaviour:
Proposed behaviour (via strategy or opt-in):
Considerations:
ServerRequestInterfaceinjection should remain optionalTarget: 7.x