State of PSR-15

172 просмотра
Перейти к первому непрочитанному сообщению

Woody Gilk

не прочитано,
15 июл. 2017 г., 11:40:2715.07.2017
– PHP Framework Interoperability Group
Hello FIG & company,

I wanted to send a quick progress report on PSR-15. Life has been busy and the working group is doing its best to finish this up.

The first order of business is addressing the concerns brought up by Rasmus and Michael in this thread:


PSR-15 will define HandlerInterface, MiddlewareInterface, and DelegateInterface. These will be two separate packages (names subject to change):

psr/http-server-handler (handler)
psr/http-server-middleware (middleware + delegate, depends on handler)

The HandlerInterface signature will be:

__invoke(ServerRequestInterface $request): ResponseInterface

The MiddlewareInterface signature will be:

process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface

The DelegateInterface will simply be an extension of HandlerInterface. (Are we certain we need delegate?)

As such, a middleware would look something like this:

function process(ServerRequestInterface $request, DelegateInterface $delegate)
{
    if ($this->isNotValid($request)) {
        // create ResponseInterface error
        return $response;
    }

    // all good, continue processing
    return $delegate($request);
}

As always, feedback and thoughts on this proposal are appreciated.

Oscar Otero

не прочитано,
16 июл. 2017 г., 04:45:2316.07.2017
– php...@googlegroups.com
I really like this change and see a lot of potential to HandlerInterface. In my opinion, DelegateInterface could be removed and HandlerInterface used instead. I don’t see any value having two interfaces doing the same.
Regards.
Oscar Otero.

--
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+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAGOJM6%2Bz%2BFwfg9XTj%3D4BV36xm6Do-iHoUJ8p%3DH5x6MxAHJgggA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений