I’ve been searching the docs and forums and haven’t been able to figure this one out. It’s probably something simple that I’m missing. TIA for any leads.
Upgrading Slim2 to Slim4. I was sending large files by clearing my output buffers and writing to the output response directly in chunks. Slim was no longer handling the response at that point. I was just manually writing the headers, then the pieces of the file, so it didn’t fill up in memory.
Doesn’t appear to be the Slim4 way to do things, however. Now I’m opening the file, doing a ->getBody() then doing a body->write() for the chunks. It works but I think it’s just piling up the chunks in memory and then sending the whole thing.
What is the proper Slim4 way to return large files in low-memory use ways?
Additionally, I am building a Zip and streaming it. Same issue. I used to just send the headers and use a ZipStreamer library to write direct to output. How can I do this in Slim4?
I’m using Psr\Http\Message\ResponseInterface as Response, and I presume there’s some sort of other ResponseInterface implementing object I should be using, but so far I can’t figure that out!
Any ideas? TIA.