We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Now there is no possibility to use arguments with middleware as, for example, in Laravel.
As I imagine it, the arguments can be specified as an array within the attribute:
#[Middleware([MiddlewareA::class => ['x' => 1, 'y' => 2]])] final class SomeController { }
Inside the middleware MiddlewareA arguments can be accessed using ServerRequestInterface::getAttribute() with middleware fqcn as attribute name:
MiddlewareA
ServerRequestInterface::getAttribute()
final class MiddlewareA implements MiddlewareInterface { public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { var_dump($request->getAttribute(MiddlewareA::class)); // ['x' => 1, 'y' => 2]; } }
I'm also thinking of adding the ability to refer to symfony parameters with %parameter_name%.
%parameter_name%
#[Middleware([MiddlewareA::class => ['env' => '%app.env%']])] final class SomeController { }
Then the arguments get to the MiddlewareA, they will be resolved.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Now there is no possibility to use arguments with middleware as, for example, in Laravel.
As I imagine it, the arguments can be specified as an array within the attribute:
Inside the middleware
MiddlewareA
arguments can be accessed usingServerRequestInterface::getAttribute()
with middleware fqcn as attribute name:I'm also thinking of adding the ability to refer to symfony parameters with
%parameter_name%
.Then the arguments get to the
MiddlewareA
, they will be resolved.The text was updated successfully, but these errors were encountered: