Hi Mathieu, the with(out)Middleware methods are what makes up the stack. This is making general, what every implementation has but does differently. Would you agree with me that StackInterface should be at least an extension of the FrameInterface? Like so you can combine stacks in other stacks (without having to use a dumb StackWrapper class that implements FrameInterface).
On Sunday, 10 July 2016 14:41:50 UTC+2, Matthieu Napoli wrote: > > Hi everyone, > > I had a look at the spec and at the metadocument, but couldn't find an > answer to my questions about PSR-15 (HTTP middlewares for those mixing up > the numbers like me): > > - why are middleware stacks not middlewares too? > - as corollary, why StackInterface exists at all? > > interface StackInterface{ /** snip< withMiddleware() and > withoutMiddleware() > */ > public function process(RequestInterface $request);} > > > This looks a lot like the signature of a middleware, except it can't call > "next". I've seen scenarios where it might be useful to have a middleware > stack inside another middleware (i.e. nested in another middleware stack or > router) - here is an illustration: > https://github.com/stratifyphp/router#everything-is-a-middleware > > If we consider middleware stacks just like any other middleware, the > standard is much simpler and we don't need the StackInterface. It also > sounds to me like standardizing a middleware stack is out of scope for a > middleware standard. > > I did not forget the 2 other methods of the StackInterface: > withMiddleware() and withoutMiddleware(). These 2 methods are used for > configuration, which is often done by users. I don't see why we would want > interoperability at that level. It's like the LoggerInterface doesn't > contain methods for configuring the logger. > > Cheers > Matthieu > > -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscr...@googlegroups.com. To post to this group, send email to php-fig@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/3ee7c374-c74d-4ba1-b079-dc677a982a0c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.