PHPackages                             pablotron/zipstream - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. pablotron/zipstream

ActiveLibrary[File &amp; Storage](/categories/file-storage)

pablotron/zipstream
===================

Dynamically generate streamed zip archives.

v0.3.0(7y ago)2527↓80%1MITPHPPHP ^7

Since Sep 3Pushed 7y ago1 watchersCompare

[ Source](https://github.com/pablotron/zipstream-php)[ Packagist](https://packagist.org/packages/pablotron/zipstream)[ Docs](https://github.com/pablotron/zipstream-php)[ RSS](/packages/pablotron-zipstream/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

ZipStream-PHP
=============

[](#zipstream-php)

Overview
--------

[](#overview)

ZipStream is a library that allows you to dynamically generate streamed zip archives.

Here's an example:

```
# import zipstream class
use Pablotron\ZipStream\ZipStream;

# create the output stream
$zip = new ZipStream('example.zip');

# add a file named "hello.txt" to output archive, containing the
# string "hello world!"
$zip->add_file('hello.txt', 'hello world!');

# add a local file named "some-image.png" to the output archive as
# "picture.png"
$zip->add_file_from_path('picture.png', 'some-image.png');

# finalize the output stream
$zip->close();

```

Features:

- Generate streamed archives without saving them to disk.
- Files can be read from files, strings, streaming resources, or generated dynamically.
- Zip64 support: files and archives up to `264`bytes in size
- Stream output as an HTTP response, to a file on disk, to a resource stream, or to a custom target.
- [MIT](https://opensource.org/licenses/MIT)-licensed: Use freely, even in commercial projects -- without restrictions.
- Self-contained: Single source file with no required external dependencies, so you can easily embed `ZipStream.php` directly into your source tree if necessary.

Dependencies
------------

[](#dependencies)

- PHP: 7.0 or newer (required).
- [Composer](https://getcomposer.org/): Used for installation (optional, see below).
- [Phan](https://github.com/phan/phan): Used for static analysis (optional).
- [phpDocumentor](https://phpdoc.org/): Used to generate the API documentation (optional).
- [PHPUnit](https://phpunit.de/): Used to run the test suite (optional).

*Note:* Consider an older version of ZipStream if you need PHP 5.x support.

Installation
------------

[](#installation)

### Using [Composer](https://getcomposer.org/)

[](#using-composer)

```
# in your project root
composer require pablotron/zipstream:~0.3

```

Or add it to the `composer.json` for your project, like so:

```
"require": {
  "pablotron/zipstream": "~0.3"
},

```

### Manual Installation

[](#manual-installation)

The source file for ZipStream is entirely self-contained, which means you can embed it directly in your project without using [Composer](https://getcomposer.org/) by doing the following:

```
# copy file to your project
cp src/ZipStream.php path/to/your/project/

# then, somewhere in your project...
require_once 'path/to/ZipStream.php';

```

Documentation
-------------

[](#documentation)

The API documentation is available online at the following URL:

You can generate the API documentation using [Composer](https://getcomposer.org/), like so:

```
# generate api documentation in "docs/" directory
composer docs

```

Brief usage examples are available in the `examples/` directory.

Tests
-----

[](#tests)

You can run the test suite via [Composer](https://getcomposer.org/) like so:

```
# run the test suite
composer test

```

License
-------

[](#license)

Copyright 2007-2018 Paul Duncan ()

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2810d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/238903?v=4)[pabs](/maintainers/pabs)[@Pabs](https://github.com/Pabs)

---

Top Contributors

[![pablotron](https://avatars.githubusercontent.com/u/523681?v=4)](https://github.com/pablotron "pablotron (99 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pablotron-zipstream/health.svg)

```
[![Health](https://phpackages.com/badges/pablotron-zipstream/health.svg)](https://phpackages.com/packages/pablotron-zipstream)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
