-
-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Labels
Description
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
ServerRequestInterfaceinjection 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
Reactions are currently unavailable