PHPackages                             zorx/zipper - 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. zorx/zipper

ActiveLibrary

zorx/zipper
===========

This is a little neat helper for the ZipArchive methods with handy functions

0.6.3(9y ago)11.4k1Apache2PHPPHP &gt;=5.4.0

Since Nov 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/zorx/Zipper)[ Packagist](https://packagist.org/packages/zorx/zipper)[ Docs](http://github.com/Chumper/zipper)[ RSS](/packages/zorx-zipper/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (8)Used By (1)

\#Zipper

[![Build Status](https://camo.githubusercontent.com/9bbc0529ee78158aae6353b1ed31e24a84f7b31c7d5b4a552c60513d4f5e0a9c/68747470733a2f2f7472617669732d63692e6f72672f4368756d7065722f5a69707065722e706e67)](https://travis-ci.org/Chumper/Zipper)

This is a simple Wrapper around the ZipArchive methods with some handy functions.

\##Installation

1. Add this package to the list of required packages, inside `composer.json`

- for Laravel 5: `"chumper/zipper": "0.6.x"`
- for Laravel 4: `"chumper/zipper": "0.5.x"`

2. Run `composer update`
3. Go to `app/config/app.php`

- add to providers `'Chumper\Zipper\ZipperServiceProvider'`
- add to aliases `'Zipper' => 'Chumper\Zipper\Zipper'`

You can now access Zipper with the `Zipper` alias.

\##Simple example

```
$files = glob('public/files/*');
Zipper::make('public/test.zip')->add($files);
```

- by default the package will create the `test.zip` in the project route folder but in the example above we changed it to `project_route/public/`.

\####Another example

```
$zipper = new \Chumper\Zipper\Zipper;

$zipper->make('test.zip')->folder('test')->add('composer.json');
$zipper->zip('test.zip')->folder('test')->add('composer.json','test');

$zipper->remove('composer.lock');

$zipper->folder('mySuperPackage')->add(
    array(
        'vendor',
        'composer.json'
    ),
);

$zipper->getFileContent('mySuperPackage/composer.json');

$zipper->make('test.zip')->extractTo('',array('mySuperPackage/composer.json'),Zipper::WHITELIST);
```

You can easily chain most functions, except `getFileContent`, `getStatus`, `close` and `extractTo` which must come at the end of the chain.

The main reason I wrote this little package is the `extractTo` method since it allows you to be very flexible when extracting zips. So you can for example implement an update method which will just override the changed files.

\##Functions

**make($pathToFile)**

`Create` or `Open` a zip archive; if the file does not exists it will create a new one. It will return the Zipper instance so you can chain easily.

**add($files/folder)**

You can add and array of Files, or a Folder which all the files in that folder will then be added, so from the first example we could instead do something like `$files = 'public/files/';`.

**addString($filename, $content)**

add a single file to the zip by specifying a name and content as strings.

**remove($file/s)**

removes a single file or an array of files from the zip.

**folder($folder)**

Specify a folder to 'add files to' or 'remove files from' from the zip, example

```
Zipper::make('test.zip')->folder('test')->add('composer.json');
Zipper::make('test.zip')->folder('test')->remove('composer.json');

```

**home()**

Resets the folder pointer.

**zip($fileName)**

Uses the ZipRepository for file handling.

**getFileContent($filePath)**

get the content of a file in the zip. This will return the content or false.

**getStatus()**

get the opening status of the zip as integer.

**close()**

closes the zip and writes all changes.

**extractTo($path)**

Extracts the content of the zip archive to the specified location, for example

```
Zipper::make('test.zip')->folder('test')->extractTo('foo');

```

This will go into the folder `test` in the zip file and extract the content of that folder only to the folder `foo`, this is equal to using the `Zipper::WHITELIST`.

This command is really nice to get just a part of the zip file, you can also pass a 2nd &amp; 3rd param to specify a single or an array of files that will be

white listed

> **Zipper::WHITELIST**

```
Zipper::make('test.zip')->extractTo('public', array('vendor'), Zipper::WHITELIST);

```

Which will extract the `test.zip` into the `public` folder but **only** the folder `vendor` inside the zip will be extracted.

or black listed

> **Zipper::BLACKLIST**

```
Zipper::make('test.zip')->extractTo('public', array('vendor'), Zipper::BLACKLIST);

```

Which will extract the `test.zip` into the `public` folder except the folder `vendor` inside the zip will not be extracted.

\##Development

Maybe it is a good idea to add other compression functions like rar, phar or bzip2 etc... Everything is setup for that, if you want just fork and develop further.

If you need other functions or got errors, please leave an issue on github.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor4

4 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.

###  Release Activity

Cadence

Every ~111 days

Recently: every ~128 days

Total

6

Last Release

3631d ago

PHP version history (2 changes)0.5.0PHP &gt;=5.3.0

0.6.2PHP &gt;=5.4.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4219529?v=4)[Amine Oudjehih](/maintainers/zorx)[@zorx](https://github.com/zorx)

---

Top Contributors

[![Chumper](https://avatars.githubusercontent.com/u/919670?v=4)](https://github.com/Chumper "Chumper (4 commits)")[![zorx](https://avatars.githubusercontent.com/u/4219529?v=4)](https://github.com/zorx "zorx (4 commits)")[![thecotne](https://avatars.githubusercontent.com/u/1606993?v=4)](https://github.com/thecotne "thecotne (3 commits)")[![bart](https://avatars.githubusercontent.com/u/5200235?v=4)](https://github.com/bart "bart (2 commits)")[![plantwebdesign](https://avatars.githubusercontent.com/u/838647?v=4)](https://github.com/plantwebdesign "plantwebdesign (2 commits)")[![snipe](https://avatars.githubusercontent.com/u/197404?v=4)](https://github.com/snipe "snipe (2 commits)")[![heslil](https://avatars.githubusercontent.com/u/14540581?v=4)](https://github.com/heslil "heslil (1 commits)")[![inov](https://avatars.githubusercontent.com/u/2234246?v=4)](https://github.com/inov "inov (1 commits)")[![vool](https://avatars.githubusercontent.com/u/441840?v=4)](https://github.com/vool "vool (1 commits)")[![francescoassenza](https://avatars.githubusercontent.com/u/5212035?v=4)](https://github.com/francescoassenza "francescoassenza (1 commits)")[![arthurprogramming](https://avatars.githubusercontent.com/u/4672300?v=4)](https://github.com/arthurprogramming "arthurprogramming (1 commits)")[![berdyshev](https://avatars.githubusercontent.com/u/539090?v=4)](https://github.com/berdyshev "berdyshev (1 commits)")[![bestmomo](https://avatars.githubusercontent.com/u/2959682?v=4)](https://github.com/bestmomo "bestmomo (1 commits)")[![brujo-rojas](https://avatars.githubusercontent.com/u/1452475?v=4)](https://github.com/brujo-rojas "brujo-rojas (1 commits)")[![alesf](https://avatars.githubusercontent.com/u/1148574?v=4)](https://github.com/alesf "alesf (1 commits)")

---

Tags

laravelarchivezip

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zorx-zipper/health.svg)

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

PHPackages © 2026

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