Archive using PHP

Guys I found a very good script for create zip archive using PHP. Now you don’t need to wait for deploy all the files over the server manually.

This post will explain you how you can create a archive using php.

This class allows programmer to easily zip files on the fly. This PHP class is capable of Zipping a single file or even an entire directory.

To use this Zip class file,
-You have to include this file in your project.
-Create class object.
-Call the public function compress(); this function takes two arguments, source and destination. You can omit the second argument, and then working folder will be the destination. On success this function will return the Zip file name.
-An example file is given to understand the mater.

This class requires extension ZLibEnabled. These are default for most site hosts around the world, and for the PHP Win32 dist.

include “recurseZip.php”;

//Source file or directory to be compressed.


//Destination folder where we create Zip file.
$z=new recurseZip();
echo $z->compress($src,$dst);
echo ‘Directory not exit';