Add ImageResponse?
How about adding an Zend\Diactoros\Response\ImageResponse that supports the most common file types like JPG, GIF and PNG? How could this be archieved?
I would say let Diactoros be safe from all these and only rely on the psr-7 interfaces.
If we need, we can add to Diactoros\Extras or something.
You may ask, what is the advantage ?
If we do add more helper function people will use those, and the purpose of switching between psr-7 packages will get into trouble. Lets not bring it due to the same.
@harikt
Thanks for your feedback. For the same reason then Zend\Diactoros\Response\HtmlResponse or Zend\Diactoros\Response\JsonResponse should be deleted.
I don't know that will happen due to BC break. But I think yes.
But these Reponse classes are really useful in the context of a Zend\Expressive application. If you want to remove them from Zend\Diactoros where should they be placed? Moving them to a different Zend\Diactoros package won't really solve the problem. People will still use them.
@RalfEggert I don't know the whole edge cases, but this is what I was thinking.
Zend\Diactoros\Extras can be type hinted to psr-7 response interfaces. So that means not just diactors can use these, but also any psr-7 responses.
But I understand that is not so simple, as the current ones are doing.
return new [JsonResponse](https://github.com/zendframework/zend-diactoros/blob/master/src/Response/JsonResponse.php)();
So I don't have a real answer for the current time. But I will think about the same.
I want to keep them. I don't see how they reduce compatibility with PSR7. Those helper methods still create a PSR7 ResponseInterface. We typically only use those helper classes on controllers (which are tied to a framework like Expressive, so it definitely makes sense to use them), but on other layer we still typehint against ResponseInterface.
Those are just shortcuts that are super convenient to use. -1 for removing them.
@bakura10
I have the same opinion that they are very useful and should be kept.
But what about the Zend\Diactoros\Response\ImageResponse I suggested?
I feel we should support anything that is often required. I'm not sure about ImageResponse. What is the use case? You return an image after processing in the back-end?
This repository has been closed and moved to laminas/laminas-diactoros; a new issue has been opened at https://github.com/laminas/laminas-diactoros/issues/28.