Closed Isinlor closed 7 years ago
I must say that I'm quite +1 on this. Namespace doesn't need to change either, just the interface could be extracted into zendframework/zend-stratigility-middleware-specification
.
In addition to that, this would allow us to "abandon" the interface package once the PSR specification is ready (if we want to rely on that, in future), which gives a clear message to users, whilst keeping zendframework/zend-stratigility
alive.
/cc @jschreuder
We'll be leaving it in here until PSR-15 is either approved or abandonded; at that point, we'll update our own middleware interface to extend that one, and developers can typehint against PSR-15 for compatibility.
Since that specification is still in flux, I'd rather not go to the effort of separating it out; our current interface is specific to the implementation Stratigility consumes at this point.
Urgh, PSR-15 is really a stack frame emulation system now?
/me sighs...
@Ocramius Not entirely. It's codifying what we do with $next
; we're moving away from the "frame" reference, and, IIUC, getting rid of that stack interface (as it's not necessary for the interoperability aspects).
Basically, it will come down to:
interface ServerMiddlewareInterface
{
public function process(ServerRequestInterface $request, DelegateInterface $delegate) : ResponseInterface ;
}
interface DelegateInterface
{
public function next(RequestInterface $request) : ResponseInterface ;
}
(There will likely be a more generic MiddlewareInterface
that type-hints only on RequestInterface
, to allow client-side applications, which is why DelegateInterface
does not type-hint on the more specific ServerRequestInterface
.)
@weierophinney sorry for the OT, let's end the design discussion there, and resume the topic once the spec is through. I've got a lot of faith in your design decisions on this, though :-)
Closing. Version 2.0.0 will use only http-interop interfaces, and MiddlewareInterface
goes away in that version. (See the develop branch for details.)
Hello,
Would it be possible to move move MiddlewareInterface to separate package? I believe that it should not require BC.
This would allow eg. PSR7Session middelware to not depend on concrete implementation of Startigility and therefore reduce code pollution. https://github.com/Ocramius/PSR7Session/issues/53