PHPackages                             productflowbv/laravel-zip - 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. productflowbv/laravel-zip

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

productflowbv/laravel-zip
=========================

laravel-zip is the world's leading zip utility for file compression and backup.

1.0.8(6mo ago)11.3kMITPHPPHP &gt;=8.2CI failing

Since May 26Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/productflowbv/laravel-zip)[ Packagist](https://packagist.org/packages/productflowbv/laravel-zip)[ Docs](http://www.zanysoft.net)[ RSS](/packages/productflowbv-laravel-zip/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (8)Versions (10)Used By (0)

zanysoft/laravel-zip
====================

[](#zanysoftlaravel-zip)

[![Downloads](https://camo.githubusercontent.com/4e188f219ee01744ad8efebb2f3e8c99563045cf9441434db0ce376bbd2e3f1c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70726f64756374666c6f7762762f6c61726176656c2d7a69702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/productflowbv/laravel-zip)[![GitHub license](https://camo.githubusercontent.com/d1fd4abd3412e998ebcda9102dd496ed1595099a5102abb07adca3ba8d2d4fde/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d696e666f726d6174696f6e616c2e737667)](https://github.com/productflowbv/laravel-zip/blob/master/LICENSE)[![Maintenance](https://camo.githubusercontent.com/485e76f4a84388b3489fd23ddd5af5056cf31a02a951c746a37cc6d61058c01a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d61696e7461696e65642533462d7965732d696e666f726d6174696f6e616c2e737667)](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity)[![GitHub tag](https://camo.githubusercontent.com/ace9b7e758c8f7dbc009ab18824aea1d68230ca631a5cf3d5f347e9b0146f420/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f70726f64756374666c6f7762762f6c61726176656c2d7a69702e7376673f7374796c653d666c6174266c6f676f3d6c61726176656c26636f6c6f723d696e666f726d6174696f6e616c)](https://github.com/productflowbv/laravel-zip/tags)

> laravel-zip is the world's leading zip utility for file compression and backup.

This library was written to simplify and automate Zip files management using [PHP ZipArchive](http://php.net/manual/en/class.ziparchive.php).

This project is developed by Zanysoft and is active maintained by [ProductFlow](https://www.productflow.com)

### Installation

[](#installation)

Require this package in your composer.json and update composer. This will download the package.

```
composer require zanysoft/laravel-zip

```

After updating composer, add the ServiceProvider to the providers array in config/app.php

```
ZanySoft\Zip\ZipServiceProvider::class,

```

You can optionally use the facade for shorter code. Add this to your facades:

```
'Zip' => ZanySoft\Zip\ZipFacade::class,

```

Zip usage
---------

[](#zip-usage)

use `ZanySoft\Zip\Zip` class only use `Zip` is made to handle a zip file.

- include the Zip class at top:

```
use Zip;
```

### Basic operations

[](#basic-operations)

- Open zip file:

    ```
    $zip = Zip::open('file.zip');
    ```
- Create zip file:

    ```
    $zip = Zip::create('file.zip');
    ```
- Check zip file:

    ```
    $is_valid = Zip::check('file.zip');
    ```
- Extract zip file:

    ```
    // extract whole archive
    $zip->extract('/path/to/uncompressed/files');

    // extract a file
    $zip->extract('/path/to/uncompressed/files', 'file');

    // extract multiple files
    $zip->extract('/path/to/uncompressed/files', array('file1','file2'));
    ```
- Check if zip has a file:

    ```
    // Check if archive has a file
    $zip->has('/path/to/file/in/archive');

    // Check if archive has a file case insensitively
    $zip->has('/path/to/file/in/archive', ZipArchive::FL_NOCASE);

    // Check if archive has a file ignoring directory component
    $zip->has('file', ZipArchive::FL_NODIR);

    // Check if archive has a file case insensitively ignoring directory component
    $zip->has('file', ZipArchive::FL_NOCASE|ZipArchive::FL_NODIR);
    ```
- Add a file/directory to zip:

    ```
    $zip->add('/path/to/my/file');

    // declaring path
    $zip->setPath('/path/to/my')->add('file');

    // add directory
    $zip->add('/path/to/my/directory');

    // add directory (only its content)
    $zip->add('/path/to/my/directory', true);
    ```
- Add multiple files/directories to zip:

    ```
    // using array as parameter
    $zip->add( array('/path/to/my/file1', '/path/to/my/file2');

    // chaining methods
    $zip->add('/path/to/my/file1')->add('/path/to/my/file2');

    // declaring path
    $zip->setPath('/path/to/my')->add('file1')->add('file2');
    ```
- Delete a file/directory from zip:

    ```
    $zip->delete('file');
    ```
- Delete multiple files/directories from zip:

    ```
    // using array as parameter
    $zip->delete( array('file1', 'file2') );

    // chaining methods
    $zip->delete('file1')->delete('file2');
    ```
- List content of zip file

    ```
    $zip->listFiles();
    ```
- Close zip file

    ```
    $zip->close();
    ```

### Additional methods

[](#additional-methods)

- Skip hidden files while adding directories:

    ```
    // set mode
    $zip->setSkipped('HIDDEN');

    // get mode
    $mode = $zip->getSkipped();
    ```
- Use password for zip extraction:

    ```
    // set password
    $zip->setPassword('slartibartfast');

    // get password
    $password = $zip->getPassword();
    ```
- Use a mask != 0777 for created folders:

    ```
    // set mask
    $zip->setMask(0644);

    // get mask
    $mask = $zip->getMask();
    ```

ZipManager usage
----------------

[](#zipmanager-usage)

The `\ZanySoft\Zip\ZipManager` can handle multiple `ZanySoft\Zip\Zip` objects.

- include the Zip and ZipManager class at top:

```
use ZanySoft\Zip\ZipManager;
use Zip;
```

### Basic operations

[](#basic-operations-1)

- Init the manager and register Zips:

    ```
    // init manager
    $manager = new ZipManager();

    // register existing zips
    $manager->addZip( Zip::open('/path/to/my/file1.zip') )
            ->addZip( Zip::open('/path/to/my/file2.zip') );

    // register a new zip
    $manager->addZip( Zip::create('/path/to/my/file3.zip') );
    ```
- Basic zips management:

    ```
    // get a list of registered zips
    $list = $manager->listZips();

    // remove a zip
    $manager->removeZip($ZipObject);

    // get a Zip
    $zip = $manager->getZip(0);
    ```
- Add files to all zips:

    ```
    $manager-> = new ZipManager();

    // register existing zips
    $manager->addZip( Zip::open('/path/to/my/file1.zip') )
            ->addZip( Zip::open('/path/to/my/file2.zip') );

    // register a new zip
    $manager->addZip( Zip::create('/path/to/my/file3.zip') );
    ```
- Extract zips:

    ```
    // separate content in folders
    $extract = $manager->extract('/path/to/uncompressed/files', true);

    // use a single folder
    $extract = $manager->extract('/path/to/uncompressed/files', false);

    // extract single file
    $extract = $manager->extract('/path/to/uncompressed/files', false, 'file');

    // extract multiple files
    $extract = $manager->extract('/path/to/uncompressed/files', false, array('file1','file2'));
    ```
- Merge zips:

    ```
    // separate content in folders
    $manager->merge('/path/to/output/file.zip', true);

    // flatten files
    $manager->merge('/path/to/output/file.zip', false);
    ```
- Close zips:

    ```
    $manager->close();
    ```

### Additional methods

[](#additional-methods-1)

- Declare path from which add files:

    ```
    // set path
    $zip->setPath('/path/to/files');

    // get path
    $path = $zip->getPath();
    ```
- Use a mask != 0777 for created folders

    ```
    // set masks
    $manager->setMask(0644);

    // get masks
    $mask = $manager->getMask();
    ```

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance66

Regular maintenance activity

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 58.3% 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 ~510 days

Recently: every ~362 days

Total

7

Last Release

207d ago

PHP version history (4 changes)1.0.2PHP &gt;=5.6.0

1.0.4PHP &gt;=7.1

1.0.5PHP &gt;=8.0

1.0.8PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/29d0f4668d6775ec87f542502d15840230d99b0b783853fd450197ffd701df70?d=identicon)[ProductFlow](/maintainers/ProductFlow)

---

Top Contributors

[![zanysoft](https://avatars.githubusercontent.com/u/2682072?v=4)](https://github.com/zanysoft "zanysoft (7 commits)")[![remcom](https://avatars.githubusercontent.com/u/3468852?v=4)](https://github.com/remcom "remcom (5 commits)")

---

Tags

laravelbackupzipextractmergeziparchivemultipleunziplaravel-ziplaravel8laravel9

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/productflowbv-laravel-zip/health.svg)

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

###  Alternatives

[zanysoft/laravel-zip

laravel-zip is the world's leading zip utility for file compression and backup.

3142.8M15](/packages/zanysoft-laravel-zip)[nelexa/zip

PhpZip is a php-library for extended work with ZIP-archives. Open, create, update, delete, extract and get info tool. Supports appending to existing ZIP files, WinZip AES encryption, Traditional PKWARE Encryption, BZIP2 compression, external file attributes and ZIP64 extensions. Alternative ZipArchive. It does not require php-zip extension.

4967.4M112](/packages/nelexa-zip)[aws/aws-sdk-php-laravel

A simple Laravel 9/10/11/12/13 service provider for including the AWS SDK for PHP.

1.7k35.6M75](/packages/aws-aws-sdk-php-laravel)[madnest/madzipper

Easier zip file handling for Laravel applications.

1382.3M6](/packages/madnest-madzipper)[splitbrain/php-archive

Pure-PHP implementation to read and write TAR and ZIP archives

1061.4M20](/packages/splitbrain-php-archive)[bringyourownideas/laravel-backblaze

Backblaze B2 Cloud Storage for Laravel 5. Original by Paul Olthof (@hpolthof) continued by @bringyourownideas

1237.8k](/packages/bringyourownideas-laravel-backblaze)

PHPackages © 2026

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