Create a zip file using PHP class ZipArchive without writing the file to disk?
Take a look at the following library, it allows creating zip files and returning them as a stream: PHPClasses.org.
Try ZipStream (link to GitHub repo, also supports install via Composer).
From original author's website (now dead):
ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.