Since we are slowly implementing psr-7 concepts in our platform, we sometimes have to make our own implementation of something that is already out there in other frameworks, like Symfony or Zend.
One of those things is the StreamInterface which wraps the input of a request (or the output of a response) into a stream-like object.
When creating the request object for an incoming request the first thing to do is create a stream object for the incoming data. Since php provides this data as the I/O stream
php://input, wrapping this native php stream is the logical course of action.
That is: until you want to seek in or rewind the stream. Even though
stream_get_meta_data will tell you that the stream is seekable, it is not. After any seek operation (
rewind) the stream will just return an empty string.
To prevent this you'll either need to cache the output of the stream or re-open the stream on a
rewind call, which will work for
php://input since php 5.6.