public function handleResource($resource)
{
while ($line = fgets($resource)) {
// do something with $line
}
}
public function handleStream(StreamInterface $stream)
{
while ($line = $stream->getLine()) {
// do something with $line
}
}You can call detach() on the stream to get the actual stream resource and use it with fgets(). Just be aware that it will make the PSR-7 stream unusable.
Read the next part of my response ;)