Zend Expressive 3 RC1

For programming and general questions on Zend Framework

Zend Expressive 3 RC1

Postby nico8361 on Wed Feb 28, 2018 5:51 pm

Hello all,

I've just installed Zend Expressive 3 RC1 and I would like to know if I'm wrong on my comprehension of PSR-15.

The basic routes are :

Code: Select all
$app->get('/', App\Handler\HomePageHandler::class, 'home');
$app->get('/api/ping', App\Handler\PingHandler::class, 'api.ping');


The registered middlewares for those routes implements RequestHandlerInterface, not MiddlewareInterface.

In this case, I think the classes implements RequestHandlerInterface because it returns directly a response.

Code: Select all
return new HtmlResponse($this->template->render('app::home-page', $data));
return new JsonResponse(['ack' => time()]);


but I could have achieved the same thing with a class implementing MiddlewareInterface ?!

So if I don't need to call another middleware I can use a class implementing RequestHandlerInterface otherwise MiddlewareInterface.

Am I wrong ?

Thanks
nico8361
 
Posts: 1
Joined: Wed Feb 28, 2018 2:16 pm

Return to Zend Framework

Who is online

Users browsing this forum: Google [Bot] and 3 guests