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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/php-fig/a6e26ac9-db37-4fc2-b840-fa7ecaa4f832%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.