Search code examples
phpphp-ziparchive

Create a zip file using PHP class ZipArchive without writing the file to disk?


I would like to create a zip file in memory using a ZipArchive (or a native PHP class) and read the content of the file back to the client. Is this possible? If so, how?

The files that I want to zip in this application are a maximum of 15 MB total. I think we should be in good shape memory-wise.


Solution

  • Take a look at the following library, it allows creating zip files and returning them as a stream: PHPClasses.org.