Stream a dynamically generated ZIP archive

1.0.0 2014-07-10 08:23 UTC


ZipStream generates ZIP archives on the fly with an object-oriented interface.

It can be used stand-alone, by creating a new ZipStream instance:

use Shareworks\Component\ZipStream\ZipStream;

$archive = new ZipStream();
$archive->addFile('path/to/file', 'path/in/archive');


The archive is directly written to the script output.

You can also use the ZipResponse wrapper for directly creating a streamed HTTP response:

use Shareworks\Component\ZipStream\ZipResponse;

$response = new ZipResponse('');
$response->addFile('path/to/file', 'path/in/archive');



You can run the unit tests with the following command:

$ cd path/to/Shareworks/Component/ZipStream/
$ composer.phar install
$ phpunit


  • Write tests
  • Add ZIP64 support for large files (beyond the 32-bit boundaries)