Skip to content
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

Closed
codeguy opened this issue Nov 19, 2016 · 3 comments
Closed

Update middleware signature for PSR-15 #2050

codeguy opened this issue Nov 19, 2016 · 3 comments

Comments

@codeguy
Copy link
Member

codeguy commented Nov 19, 2016

No description provided.

@codeguy codeguy added the Slim 4 label Nov 19, 2016
@codeguy codeguy added this to the 4.0 milestone Nov 19, 2016
@codeguy
Copy link
Member Author

codeguy commented Nov 19, 2016

Let middleware be single-pass by default. We will provide a double-pass middleware adapter for those that still want it.

@geggleto geggleto modified the milestone: 4.0 Mar 19, 2017
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
@XedinUnknown
Copy link

I really would appreciate this too, but I guess that this would require a major version bump.

@akrabat akrabat added the Has PR label Sep 16, 2018
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
akrabat added a commit that referenced this issue Feb 22, 2019
@l0gicgate
Copy link
Member

Closed as per #2555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants