ZipArchive PHP Object

Have you ever heard of the ZipArchive PHP Class? The ZipArchive PHP class is an object oriented interface to compressed file archives using the zip library. It has been available in PHP since version 5.2.0 and in PECL since 1.1.0. The alternative prior to those PHP versions was to use the Zip Functions of PHP.

The object oriented zip interface has more features than the procedural interface. Each ZipArchive instance has properties giving statistics on the archive. There are many ways for getting things done using the ZipArchive class. Adding files, attribute, comment and undo features are part of the items that makes this a better route to go than the procedural method.

Also available are the Zip Constants. They can be used as parameters when using ZipArchive methods.

In closing, I have recently rediscovered this feature. Years ago, when PHP 5.2 had just come out and DateTime was brand new, I had a task and chose to use the procedural Zip method at that time it worked great. Being a reader of the PHP general maililng list and seeing recent questions about using the ZipArchive class in PHP applications brought me to the PHP documentation page. I was happy to see it and thought that it was cool enough to write about. I hope that you can enjoy it too.