oscarotero / psr7-middlewares

[DEPRECATED] Collection of PSR-7 middlewares
MIT License
668 stars 56 forks source link

Custom Middleware #45

Closed undercloud closed 7 years ago

undercloud commented 7 years ago

Can I create my own middleware like this?

class MiddlewareMy extends MiddlewareBase
{
    public function handle(...) 
    {

    } 
}
oscarotero commented 7 years ago

I'm not sure what do you mean with "Custom middleware". Of course, you can create any middleware, there's no a MiddlewareBase, just need to create a class with the signature:

class MiddlewareMy
{
    public function __invoke(RequestInterface $request, ResponseInterface $response, callable $next)
    {
    }
}

This project is just a collection of middleware classes with this signature.

undercloud commented 7 years ago

ok)