I'd like to know how you would go about sending a long response using zend-stratigility and the PSR-7 Response and/or Stream abstractions?
For example, let's say I'm sending a million records in CSV format - I can't put all of this data into the body of a Response object, as it would require too much memory.
With an ordinary PHP script, sending a long response is easy - you just echo the content, and every time the output buffer is full, it's automatically flushed, so you're not using a ton of memory, and the user isn't waiting for the entire CSV file to be generated before the server can start sending the content.
How do you accomplish the same with PSR Response?
I'm assuming it has something to do with the Stream abstraction, but I've never used streams in PHP much, and I'm not sure how this comes into play.
General discussion on PHP
1 post • Page 1 of 1