PHPackages                             nemo64/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nemo64/zip-stream

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

nemo64/zip-stream
=================

Quickly stream multiple files without creating an archive first.

v1.0.0(7y ago)09MITPHPPHP &gt;=7.1, &lt;7.4

Since Jan 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Nemo64/zip-stream)[ Packagist](https://packagist.org/packages/nemo64/zip-stream)[ RSS](/packages/nemo64-zip-stream/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

[![Build Status](https://camo.githubusercontent.com/9fcc82a8e743927d9e7b58fd2178f5527f89ffe1d4210f0521b91a8962dbb980/68747470733a2f2f7472617669732d63692e6f72672f4e656d6f36342f7a69702d73747265616d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Nemo64/zip-stream)[![Latest Stable Version](https://camo.githubusercontent.com/5b4ed42a809d9f4a60d69bf4981fdc87ac63df16c670e8dc5825cbbb239be3b1/68747470733a2f2f706f7365722e707567782e6f72672f4e656d6f36342f7a69702d73747265616d2f762f737461626c65)](https://packagist.org/packages/Nemo64/zip-stream)[![Total Downloads](https://camo.githubusercontent.com/386628c423c5714dc4febedfadb779f03b7bfcec7903f5b01bebbfa77d2497cf/68747470733a2f2f706f7365722e707567782e6f72672f4e656d6f36342f7a69702d73747265616d2f646f776e6c6f616473)](https://packagist.org/packages/Nemo64/zip-stream)[![Monthly Downloads](https://camo.githubusercontent.com/acca5283885ac0cfc9e40b7063520f6683c936d96b7641f51f1377a47851c52a/68747470733a2f2f706f7365722e707567782e6f72672f4e656d6f36342f7a69702d73747265616d2f642f6d6f6e74686c79)](https://packagist.org/packages/Nemo64/zip-stream)[![License](https://camo.githubusercontent.com/2e2f155f569f0737407390f154d44731b3fa61b44253edc8b099fadc7244c8bf/68747470733a2f2f706f7365722e707567782e6f72672f4e656d6f36342f7a69702d73747265616d2f6c6963656e7365)](https://packagist.org/packages/Nemo64/zip-stream)

ZIP Stream
==========

[](#zip-stream)

This library allows you to create an PSR-7 stream which contains multiple files in a zip format. This is done without actually creating a zip file at any time and is therefore very light on resources. In fact, there should be very little difference compared to just sending the file though php.

Here are some special characteristics:

- no files are created so no cleanup is nessesary
- the length of the file is known before sending it making a `Content-Length` header possible (which let's the user know how long the download takes)
- it is possible to resume a download if your psr7-emitter/framework supports it.
- you don't have to output the stream to the browser, for example you can stream it using guzzle in a post request.
- there are no platform dependencies. You don't need `ext-zip` or the zip command on your machine.

But there are also some limitations:

- The created zip file has no compression at all. This is necessary for the quick size calculation. If you need that use [maennchen/zipstream-php](https://github.com/maennchen/zipstream-php)
- There is no Zip64 implementation yet so you are limited to 4GB files. There might be additional limitations in 32 bit php which I haven't investigated yet.

Example
-------

[](#example)

You'll need a way to send PSR-7 Response objects to the client. Some Frameworks start to support this but in the mean time i'll recommend you use an external library like [arrowspark/http-emitter](https://github.com/narrowspark/http-emitter) to do just that.

```
use function GuzzleHttp\Psr7\stream_for;
use function GuzzleHttp\Psr7\try_fopen;
use Narrowspark\HttpEmitter\SapiStreamEmitter;
use Nemo64\ZipStream\ZipResponse;
use Nemo64\ZipStream\ZipStream;

$zip = new ZipStream();
$zip->add('file1.jpg', stream_for(try_fopen('file1.jpg', 'r')));

// be sure that before you send this response that there is no output buffering engaged.
while (@ob_end_clean()) {}

$response = ZipResponse::create($zip, 'my_archive.zip');
$emitter = new SapiStreamEmitter();
$emitter->emit($response);
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

2663d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f18b6c8ad90bb53f9c5273b79360259b0ec172951de367046ac13ab0f1b44f63?d=identicon)[Nemo641](/maintainers/Nemo641)

---

Top Contributors

[![Nemo64](https://avatars.githubusercontent.com/u/1749936?v=4)](https://github.com/Nemo64 "Nemo64 (23 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[google/cloud-core

Google Cloud PHP shared dependency, providing functionality useful to all components.

343121.4M79](/packages/google-cloud-core)[google/cloud-functions-framework

Google Cloud Functions Framework for PHP

21313.4M](/packages/google-cloud-functions-framework)[wallabag/wallabag

open source self hostable read-it-later web application

12.6k2.2k](/packages/wallabag-wallabag)[anthropic-ai/sdk

Anthropic PHP SDK

129134.7k5](/packages/anthropic-ai-sdk)[php-heroku-client/php-heroku-client

A PHP client for the Heroku Platform API

24404.8k4](/packages/php-heroku-client-php-heroku-client)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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