Sorry Larry, if I have confused you. My aim was to show that the HandlerInterface itself can be used in many different ways, not that these examples may lead to PSRs or be compatible in some way. Although, it should show that a HandlerInterface CAN be used to specify middleware interfaces, like PSR-15.
On Monday, May 15, 2017 at 4:26:37 PM UTC+2, Larry Garfield wrote: > > The "Handler" shown in #6 is so generic as to be meaningless, or at least > I don't know what it's supposed to do. It looks almost like it's trying to > be a router, which is not the job of a middleware. > It should show that a HandlerInterface can be used to encapsulate a Blog component with its (sub-)routes (e.g. 'blog/comment', 'blog/author', …) and make such a component shareable e.g. at packagist, so it can be used in multiple applications – And yes, it is an example of a non-middleware: implementing it as a middleware makes no sense, because of the unnecessary $next/$delegate. > That said, the most compelling argument that's been made against the > current PSR-15 draft is essentially "branching" the middleware logic. My > question to Beau (or anyone from the PSR-15 team) would then be, how would > the current draft handle that? > > As a concrete example, say I want to apply: > > - AuthenticationMiddleware only to paths /admin/* > - CacheMiddleware only to paths /api/* > - RouterMiddleware to all paths. > - ActionMiddleware to all paths, which is what calls out to a > controller/action/app domain/thing. > PSR-15 and all middleware proposals in this thread are about the question, how a middleware component should look like. I.e. how should a component look like, which have to return a response and utilizes zero or more successor components. Hence, routing (like _only to pahts /admin/*_) is not defined anywhere; it is up to frameworks and it is not needed to define it for reusable middlewares. -- 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/c1354617-faa5-40ae-b000-8fcdea54af8f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
