PHPackages                             jdwil/zip-stream - 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. jdwil/zip-stream

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

jdwil/zip-stream
================

0.1.3(7y ago)76.2k1MITPHPPHP ^7

Since Apr 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jdwil/zip-stream)[ Packagist](https://packagist.org/packages/jdwil/zip-stream)[ RSS](/packages/jdwil-zip-stream/feed)WikiDiscussions master Synced 2w ago

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

Zip Stream
==========

[](#zip-stream)

This library is for generating large zip files with a low memory footprint. The contents of the zip file are never stored in memory at once. Everything is written using streams. This library is for writing zip files only and has no reading capabilities.

License
-------

[](#license)

MIT License

Getting Started
---------------

[](#getting-started)

The only requirements are PHP 7.0+ and the zlib extension (almost always enabled).

### Installing

[](#installing)

`composer require jdwil/zip-stream`

Running tests
-------------

[](#running-tests)

`./vendor/bin/phpspec run`

Examples
--------

[](#examples)

### Basic Usage

[](#basic-usage)

```
$zipStream = ZipStream::forFile('/path/to/file.zip');

// Add a file from disk
$zipStream->addFileFromDisk('foo.txt', '/path/to/foo.txt');

// Add a file from a stream
$stream = ReadStream::forFile('/path/to/bar.txt');
$zipStream->addFileFromStream('bar.txt', $stream);

// Add arbirary data
$zipStream->addFile('baz.txt', 'some arbitrary text');

// Always close the Zip Stream
$zipStream->close();

```

### Dealing with huge data sets

[](#dealing-with-huge-data-sets)

```
$zipStream = ZipStream::forFile('/path/to/file.zip');
$zipStream->beginFile('foo.txt');
while ($data = $somePdoStatement->fetch()) {
  $zipStream->addFilePart(implode(',', $data));
}
$zipStream->endFile();
$zipStream->close();

```

### Stream a ZIP file directly to the user

[](#stream-a-zip-file-directly-to-the-user)

The file is sent as it is being built, so the download begins immediately for the user.

```
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="foo.zip"');
header('Content-Transfer-Encoding: binary');

$zipStream = ZipStream::forFile('php://output');
// Build your zip file
$zipStream->close();

```

Authors
-------

[](#authors)

JD Williams

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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

Every ~165 days

Total

4

Last Release

2869d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1407981?v=4)[JD Williams](/maintainers/jdwil)[@jdwil](https://github.com/jdwil)

---

Top Contributors

[![jdwil](https://avatars.githubusercontent.com/u/1407981?v=4)](https://github.com/jdwil "jdwil (1 commits)")

---

Tags

php-libraryphp7

### Embed Badge

![Health badge](/badges/jdwil-zip-stream/health.svg)

```
[![Health](https://phpackages.com/badges/jdwil-zip-stream/health.svg)](https://phpackages.com/packages/jdwil-zip-stream)
```

###  Alternatives

[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.7k](/packages/venveo-craft-compress)

PHPackages © 2026

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