shareworks/zip-stream

Stream a dynamically generated ZIP archive

Installs: 11

Dependents: 0

Stars: 1

Watchers: 2

Language: PHP

1.0.0 2014-07-10 08:23 UTC

README

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');
...

$archive->finalize();

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('archive.zip');
$response->addFile('path/to/file', 'path/in/archive');
...

$response->send();

Resources

You can run the unit tests with the following command:

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

TODO

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