and like us on FB

There’s a ton of really good libraries for handling the zipping and unzipping of files. The following solution is super-simple in nature and uses PHP’s ZIP extension that “enables you to transparently read or write ZIP compressed archives and the files inside them”. The same class can be used to zip files and perform a number of other operations.

To zip a file, look at the ZipArchive::addFile documentation.

Shortt URL for this post: