PHPackages                             jannmylj/zipstream-php - 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. jannmylj/zipstream-php

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

jannmylj/zipstream-php
======================

ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.

03PHP

Since May 28Pushed 1y agoCompare

[ Source](https://github.com/jannmylj/ZipStream-PHP)[ Packagist](https://packagist.org/packages/jannmylj/zipstream-php)[ RSS](/packages/jannmylj-zipstream-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#zipstream-php)

[![Main Branch](https://github.com/maennchen/ZipStream-PHP/actions/workflows/branch_main.yml/badge.svg)](https://github.com/maennchen/ZipStream-PHP/actions/workflows/branch_main.yml)[![Coverage Status](https://camo.githubusercontent.com/06cd1693a483ac69376782eb1f9512d9259b6581be4ef9eea0789574a461d8f1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d61656e6e6368656e2f5a697053747265616d2d5048502f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/maennchen/ZipStream-PHP?branch=main)[![Latest Stable Version](https://camo.githubusercontent.com/26e8d62cdb7852552ae2fae662deae92f03a4a613e5a47d0d482a79fc2962ced/68747470733a2f2f706f7365722e707567782e6f72672f6d61656e6e6368656e2f7a697073747265616d2d7068702f762f737461626c65)](https://packagist.org/packages/maennchen/zipstream-php)[![Total Downloads](https://camo.githubusercontent.com/2bbc4a8b9fa3ddc4250264df81acbe5030fe8996cb5ed76502b3a5b690d07e47/68747470733a2f2f706f7365722e707567782e6f72672f6d61656e6e6368656e2f7a697073747265616d2d7068702f646f776e6c6f616473)](https://packagist.org/packages/maennchen/zipstream-php)[![Financial Contributors on Open Collective](https://camo.githubusercontent.com/f3d5e70e8c31f8cf6e58895da6f33a66abb2456270ff31603d66280519b554d2/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7a697073747265616d2f616c6c2f62616467652e7376673f6c6162656c3d66696e616e6369616c2b636f6e7472696275746f7273)](https://opencollective.com/zipstream) [![License](https://camo.githubusercontent.com/c028f032c8d5cf92c5898ec3f24b5cf0b37d8ff9e05a7475b366b758ac1b8979/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d61656e6e6368656e2f7a697073747265616d2d7068702e737667)](LICENSE)

Unstable Branch
---------------

[](#unstable-branch)

The `main` branch is not stable. Please see the [releases](https://github.com/maennchen/ZipStream-PHP/releases) for a stable version.

Overview
--------

[](#overview)

A fast and simple streaming zip file downloader for PHP. Using this library will save you from having to write the Zip to disk. You can directly send it to the user, which is much faster. It can work with S3 buckets or any PSR7 Stream.

Please see the [LICENSE](LICENSE) file for licensing and warranty information.

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

[](#installation)

Simply add a dependency on maennchen/zipstream-php to your project's `composer.json` file if you use Composer to manage the dependencies of your project. Use following command to add the package to your project's dependencies:

```
composer require maennchen/zipstream-php
```

Usage
-----

[](#usage)

For detailed instructions, please check the [Documentation](https://maennchen.github.io/ZipStream-PHP/).

```
// Autoload the dependencies
require 'vendor/autoload.php';

// create a new zipstream object
$zip = new ZipStream\ZipStream(
    outputName: 'example.zip',

    // enable output of HTTP headers
    sendHttpHeaders: true,
);

// create a file named 'hello.txt'
$zip->addFile(
    fileName: 'hello.txt',
    data: 'This is the contents of hello.txt',
);

// add a file named 'some_image.jpg' from a local file 'path/to/image.jpg'
$zip->addFileFromPath(
    fileName: 'some_image.jpg',
    path: 'path/to/image.jpg',
);

// finish the zip stream
$zip->finish();
```

Upgrade to version 3.0.0
------------------------

[](#upgrade-to-version-300)

### General

[](#general)

- Minimum PHP Version: `8.1`
- Only 64bit Architecture is supported.
- The class `ZipStream\Option\Method` has been replaced with the enum `ZipStream\CompressionMethod`.
- Most clases have been flagged as `@internal` and should not be used from the outside. If you're using internal resources to extend this library, please open an issue so that a clean interface can be added &amp; published. The externally available classes &amp; enums are:
    - `ZipStream\CompressionMethod`
    - `ZipStream\Exception*`
    - `ZipStream\ZipStream`

### Archive Options

[](#archive-options)

- The class `ZipStream\Option\Archive` has been replaced in favor of named arguments in the `ZipStream\ZipStream` constuctor.
- The archive options `largeFileSize` &amp; `largeFileMethod` has been removed. If you want different `compressionMethods` based on the file size, you'll have to implement this yourself.
- The archive option `httpHeaderCallback` changed the type from `callable` to `Closure`.
- The archive option `zeroHeader` has been replaced with the option `defaultEnableZeroHeader` and can be overridden for every file. Its default value changed from `false` to `true`.
- The archive option `statFiles` was removed since the library no longer checks filesizes this way.
- The archive option `deflateLevel` has been replaced with the option `defaultDeflateLevel` and can be overridden for every file.
- The first argument (`name`) of the `ZipStream\ZipStream` constuctor has been replaced with the named argument `outputName`.
- Headers are now also sent if the `outputName` is empty. If you do not want to automatically send http headers, set `sendHttpHeaders` to `false`.

### File Options

[](#file-options)

- The class `ZipStream\Option\File` has been replaced in favor of named arguments in the `ZipStream\ZipStream->addFile*` functions.
- The file option `method` has been renamed to `compressionMethod`.
- The file option `time` has been renamed to `lastModificationDateTime`.
- The file option `size` has been renamed to `maxSize`.

Upgrade to version 2.0.0
------------------------

[](#upgrade-to-version-200)

Upgrade to version 1.0.0
------------------------

[](#upgrade-to-version-100)

Contributing
------------

[](#contributing)

ZipStream-PHP is a collaborative project. Please take a look at the [.github/CONTRIBUTING.md](.github/CONTRIBUTING.md) file.

Version Support
---------------

[](#version-support)

Versions are supported according to the table below.

Please do not open any pull requests contradicting the current version support status.

Careful: Always check the `README` on `main` for up-to-date information.

VersionNew FeaturesBugfixesSecurity*3*✓✓✓*2*✗✓✓*1*✗✗✓0✗✗✗This library aligns itself with the PHP core support. New features and bugfixes will only target PHP versions according to their current status.

See:

About the Authors
-----------------

[](#about-the-authors)

- Paul Duncan  -
- Jonatan Männchen  -
- Jesse G. Donat  -
- Nicolas CARPi  -
- Nik Barham  -

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1813e37c1aa4e77534e7d81b9b8da5325e095b5a10af66034532320b2c8da042?d=identicon)[Jann Mylj](/maintainers/Jann%20Mylj)

---

Top Contributors

[![maennchen](https://avatars.githubusercontent.com/u/333918?v=4)](https://github.com/maennchen "maennchen (134 commits)")[![donatj](https://avatars.githubusercontent.com/u/133747?v=4)](https://github.com/donatj "donatj (57 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (31 commits)")[![NicolasCARPi](https://avatars.githubusercontent.com/u/3043706?v=4)](https://github.com/NicolasCARPi "NicolasCARPi (24 commits)")[![leftdevel](https://avatars.githubusercontent.com/u/843337?v=4)](https://github.com/leftdevel "leftdevel (3 commits)")[![PaolaRuby](https://avatars.githubusercontent.com/u/79208489?v=4)](https://github.com/PaolaRuby "PaolaRuby (3 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (3 commits)")[![andrejpavlovic](https://avatars.githubusercontent.com/u/983644?v=4)](https://github.com/andrejpavlovic "andrejpavlovic (2 commits)")[![ogyr](https://avatars.githubusercontent.com/u/1782?v=4)](https://github.com/ogyr "ogyr (2 commits)")[![pfofi](https://avatars.githubusercontent.com/u/7479939?v=4)](https://github.com/pfofi "pfofi (2 commits)")[![sagara-](https://avatars.githubusercontent.com/u/310250?v=4)](https://github.com/sagara- "sagara- (2 commits)")[![stil](https://avatars.githubusercontent.com/u/714004?v=4)](https://github.com/stil "stil (2 commits)")[![FelixJacobi](https://avatars.githubusercontent.com/u/25072300?v=4)](https://github.com/FelixJacobi "FelixJacobi (1 commits)")[![monkeywithacupcake](https://avatars.githubusercontent.com/u/7316730?v=4)](https://github.com/monkeywithacupcake "monkeywithacupcake (1 commits)")[![mtak3](https://avatars.githubusercontent.com/u/1726154?v=4)](https://github.com/mtak3 "mtak3 (1 commits)")[![evertharmeling](https://avatars.githubusercontent.com/u/308513?v=4)](https://github.com/evertharmeling "evertharmeling (1 commits)")[![thedomeffm](https://avatars.githubusercontent.com/u/29406401?v=4)](https://github.com/thedomeffm "thedomeffm (1 commits)")[![dabinat](https://avatars.githubusercontent.com/u/18251622?v=4)](https://github.com/dabinat "dabinat (1 commits)")[![tomschlick](https://avatars.githubusercontent.com/u/70184?v=4)](https://github.com/tomschlick "tomschlick (1 commits)")[![Ph0tonic](https://avatars.githubusercontent.com/u/5320541?v=4)](https://github.com/Ph0tonic "Ph0tonic (1 commits)")

### Embed Badge

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

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

###  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)
