php zip library


A few days back I was on a project where, I got some innovative job (for me atleast).

i.e. There was a list of files displayed on a page, and that list is simply displayed by reading the content of a directory and it’s sub directory. Each list item were having a checkbox. Now the challenge for me was to create a zip archive of the selected list items, as same as you have seen for gmail attachments. I searched a lot and finally got a great library for this, yes that is pclzip.

Using pclzip

You can compress and extract zip formatted archives.

PclZip gives you the ability to manipulate zip formatted arhives. You can create an archive, list the content and extract all its content in the file system.

PclZip defines an object class which represent a Zip Archive. This class manages the archive properties and offers access method and actions on the archive.

Trust me its very simple to use and very vast library with a lot of functions. Even most popular CMS like joomla, drupal, nucleus, moodle, wordpress etc. uses the same PCLZIP.