php://memory is a stream that lives in RAM.
php://temp starts in RAM, spills to disk after 2MB (configurable, see below!).
No tmpfile(). No temp directory. No cleanup.
Perfect for building files in memory before sending in #PHP!
Did you know the "maxmemory: " trick?