-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
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
Update middleware signature for PSR-15 #2050
Milestone
Comments
Let middleware be single-pass by default. We will provide a double-pass middleware adapter for those that still want it. |
This was referenced Nov 19, 2016
bnf
added a commit
to bnf/Slim
that referenced
this issue
Jan 10, 2018
PSR-15 middlewares can be registered using the existing API: App::add() and Routable::add() Those methods are extended to accept objects that implement the MiddlewareInterface (or class names that refer to classes which implement the MiddlewareInterface). We do not add new entry points for middleware registration, as the type of the middleware can be detecting through the MiddlewareInterface which all PSR-15 middlewares implement. Both, classes that do not implement MiddlewareInterface, and closures will be handled as single pass middleware – as before. That means there's no support for closures with a PSR-15 single-pass signature. The detection of the middleware type is implemented in the callable resolver. While that might look like something which is out of scope for the CallableResolver, reasons are: a) The internal slim middleware stack stays at is – it handles callables only. (and in cannot be changed anyway as long double-pass middlewares need to be supported. Double-pass middlewares expect a Response object that needs to be passed along the middleware stack. Therefore we'd need to wrap PSR-15 middleware's in any case – which is what this change provides) b) the CallableResolver resolves (in terms for transforms) a callable from PSR-15 style middleware. TODO: Add more tests for: - Adapter\SinglePassMiddleware - Routable with PSR-15 Middlewares Closes: slimphp#2050 Closes: slimphp#2051
bnf
added a commit
to bnf/Slim
that referenced
this issue
Jan 10, 2018
PSR-15 middlewares can be registered using the existing API: `App::add()` and `Routable::add()` Those methods are extended to accept objects that implement the MiddlewareInterface (or class names that refer to classes which implement the MiddlewareInterface). We do not add new entry points for middleware registration, as the type of the middleware can be detecting through the MiddlewareInterface which all PSR-15 middlewares implement. Both, classes that do not implement MiddlewareInterface, and closures will be handled as single pass middleware – as before. That means there's no support for closures with a PSR-15 single-pass signature. The detection of the middleware type is implemented in the callable resolver. While that might look like something which is out of scope for the CallableResolver, reasons are: a) The internal slim middleware stack stays at is – it handles callables only. (and in cannot be changed anyway as long double-pass middlewares need to be supported. Double-pass middlewares expect a Response object that needs to be passed along the middleware stack. Therefore we'd need to wrap PSR-15 middleware's in any case – which is what this change provides) b) the CallableResolver resolves (in terms for transforms) a callable from PSR-15 style middleware. TODO: Add more tests for: - Adapter\SinglePassMiddleware - Routable with PSR-15 Middlewares Closes: slimphp#2050 Closes: slimphp#2051
bnf
added a commit
to bnf/Slim
that referenced
this issue
Jan 10, 2018
PSR-15 middlewares can be registered using the existing API: `App::add()` and `Routable::add()` Those methods are extended to accept objects that implement the MiddlewareInterface (or class names that refer to classes which implement the MiddlewareInterface). We do not add new entry points for middleware registration, as the type of the middleware can be detecting through the MiddlewareInterface which all PSR-15 middlewares implement. Both, classes that do not implement MiddlewareInterface, and closures will be handled as single pass middleware – as before. That means there's no support for closures with a PSR-15 single-pass signature. The detection of the middleware type is implemented in the callable resolver. While that might look like something which is out of scope for the CallableResolver, reasons are: a) The internal slim middleware stack stays at is – it handles callables only. (and in cannot be changed anyway as long double-pass middlewares need to be supported. Double-pass middlewares expect a Response object that needs to be passed along the middleware stack. Therefore we'd need to wrap PSR-15 middleware's in any case – which is what this change provides) b) the CallableResolver resolves (in terms for transforms) a callable from PSR-15 style middleware. TODO: Add more tests for: - Adapter\SinglePassMiddleware - Routable with PSR-15 Middlewares Closes: slimphp#2050 Closes: slimphp#2051
bnf
added a commit
to bnf/Slim
that referenced
this issue
Jan 10, 2018
PSR-15 middlewares can be registered using the existing API: `App::add()` and `Routable::add()` Those methods are extended to accept objects that implement the MiddlewareInterface (or class names that refer to classes which implement the MiddlewareInterface). We do not add new entry points for middleware registration, as the type of the middleware can be detecting through the MiddlewareInterface which all PSR-15 middlewares implement. Both, classes that do not implement MiddlewareInterface, and closures will be handled as single pass middleware – as before. That means there's no support for closures with a PSR-15 single-pass signature. The detection of the middleware type is implemented in the callable resolver. While that might look like something which is out of scope for the CallableResolver, reasons are: a) The internal slim middleware stack stays at is – it handles callables only. (and in cannot be changed anyway as long double-pass middlewares need to be supported. Double-pass middlewares expect a Response object that needs to be passed along the middleware stack. Therefore we'd need to wrap PSR-15 middleware's in any case – which is what this change provides) b) the CallableResolver resolves (in terms for transforms) a callable from PSR-15 style middleware. TODO: Add more tests for: - Adapter\SinglePassMiddleware - Routable with PSR-15 Middlewares Closes: slimphp#2050 Closes: slimphp#2051
bnf
added a commit
to bnf/Slim
that referenced
this issue
Jan 10, 2018
PSR-15 middlewares can be registered using the existing API: `App::add()` and `Routable::add()` Those methods are extended to accept objects that implement the MiddlewareInterface (or class names that refer to classes which implement the MiddlewareInterface). We do not add new entry points for middleware registration, as the type of the middleware can be detecting through the MiddlewareInterface which all PSR-15 middlewares implement. Both, classes that do not implement MiddlewareInterface, and closures will be handled as single pass middleware – as before. That means there's no support for closures with a PSR-15 single-pass signature. The detection of the middleware type is implemented in the callable resolver. While that might look like something which is out of scope for the CallableResolver, reasons are: a) The internal slim middleware stack stays at is – it handles callables only. (and in cannot be changed anyway as long double-pass middlewares need to be supported. Double-pass middlewares expect a Response object that needs to be passed along the middleware stack. Therefore we'd need to wrap PSR-15 middleware's in any case – which is what this change provides) b) the CallableResolver resolves (in terms for transforms) a callable from PSR-15 style middleware. TODO: Add more tests for: - Adapter\SinglePassMiddleware - Routable with PSR-15 Middlewares Closes: slimphp#2050 Closes: slimphp#2051
bnf
added a commit
to bnf/Slim
that referenced
this issue
Jan 10, 2018
PSR-15 middlewares can be registered using the existing API: `App::add()` and `Routable::add()` Those methods are extended to accept objects that implement the MiddlewareInterface (or class names that refer to classes which implement the MiddlewareInterface). We do not add new entry points for middleware registration, as the type of the middleware can be detecting through the MiddlewareInterface which all PSR-15 middlewares implement. Both, classes that do not implement MiddlewareInterface, and closures will be handled as single pass middleware – as before. That means there's no support for closures with a PSR-15 single-pass signature. The detection of the middleware type is implemented in the callable resolver. While that might look like something which is out of scope for the CallableResolver, reasons are: a) The internal slim middleware stack stays at is – it handles callables only. (and in cannot be changed anyway as long double-pass middlewares need to be supported. Double-pass middlewares expect a Response object that needs to be passed along the middleware stack. Therefore we'd need to wrap PSR-15 middleware's in any case – which is what this change provides) b) the CallableResolver resolves (in terms for transforms) a callable from PSR-15 style middleware. TODO: Add more tests for: - Adapter\SinglePassMiddleware - Routable with PSR-15 Middlewares Closes: slimphp#2050 Closes: slimphp#2051
bnf
added a commit
to bnf/Slim
that referenced
this issue
Jan 12, 2018
PSR-15 middlewares can be registered using the existing API: `App::add()` and `Routable::add()` Those methods are extended to accept objects that implement the MiddlewareInterface (or class names that refer to classes which implement the MiddlewareInterface). We do not add new entry points for middleware registration, as the type of the middleware can be detecting through the MiddlewareInterface which all PSR-15 middlewares implement. Both, classes that do not implement MiddlewareInterface, and closures will be handled as single pass middleware – as before. That means there's no support for closures with a PSR-15 single-pass signature. The detection of the middleware type is implemented in the callable resolver. While that might look like something which is out of scope for the CallableResolver, reasons are: a) The internal slim middleware stack stays at is – it handles callables only. (and in cannot be changed anyway as long double-pass middlewares need to be supported. Double-pass middlewares expect a Response object that needs to be passed along the middleware stack. Therefore we'd need to wrap PSR-15 middleware's in any case – which is what this change provides) b) the CallableResolver resolves (in terms for transforms) a callable from PSR-15 style middleware. TODO: Add more tests for: - Adapter\SinglePassMiddleware - Routable with PSR-15 Middlewares Closes: slimphp#2050 Closes: slimphp#2051
I really would appreciate this too, but I guess that this would require a major version bump. |
bnf
added a commit
to bnf/Slim
that referenced
this issue
Jan 24, 2019
PSR-15 middlewares can be registered using the existing API: `App::add()` and `Routable::add()` Those methods are extended to accept objects that implement the MiddlewareInterface (or class names that refer to classes which implement the MiddlewareInterface). We do not add new entry points for middleware registration, as the type of the middleware can be detecting through the MiddlewareInterface which all PSR-15 middlewares implement. Both, classes that do not implement MiddlewareInterface, and closures will be handled as single pass middleware – as before. That means there's no support for closures with a PSR-15 style single-pass signature. The detection of the middleware type is implemented in the callable resolver. While that might look like something which is out of scope for the CallableResolver, reasons are: a) The internal slim middleware stack stays at is – it handles callables only. (and in cannot be changed anyway as long double-pass middlewares need to be supported. Double-pass middlewares expect a Response object that needs to be passed along the middleware stack. Therefore we'd need to wrap PSR-15 middleware's in any case – which is what this change provides) b) the CallableResolver resolves (in terms for transforms) a callable from PSR-15 style middleware. TODO: Add more tests for: - Adapter\PsrMiddleware - Routable with PSR-15 Middlewares Resolves slimphp#2050
bnf
added a commit
to bnf/Slim
that referenced
this issue
Jan 24, 2019
PSR-15 middlewares can be registered using the existing API: `App::add()` and `Routable::add()` Those methods are extended to accept objects that implement the MiddlewareInterface (or class names that refer to classes which implement the MiddlewareInterface). We do not add new entry points for middleware registration, as the type of the middleware can be detecting through the MiddlewareInterface which all PSR-15 middlewares implement. Both, classes that do not implement MiddlewareInterface, and closures will be handled as single pass middleware – as before. That means there's no support for closures with a PSR-15 style single-pass signature. The detection of the middleware type is implemented in the callable resolver. While that might look like something which is out of scope for the CallableResolver, reasons are: a) The internal slim middleware stack stays at is – it handles callables only. (and in cannot be changed anyway as long double-pass middlewares need to be supported. Double-pass middlewares expect a Response object that needs to be passed along the middleware stack. Therefore we'd need to wrap PSR-15 middleware's in any case – which is what this change provides) b) the CallableResolver resolves (in terms for transforms) a callable from PSR-15 style middleware. TODO: Add more tests for: - Adapter\PsrMiddleware - Routable with PSR-15 Middlewares Resolves slimphp#2050
Closed as per #2555 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: