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

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

victor78/yii2-zipper
====================

Yii2-Zipper is archiving component for Yii2.

v1.0.0(3w ago)128.9k↑12%2[2 issues](https://github.com/victor78/yii2-zipper/issues)1MITPHPPHP &gt;=8.1CI passing

Since Apr 20Pushed 3w ago1 watchersCompare

[ Source](https://github.com/victor78/yii2-zipper)[ Packagist](https://packagist.org/packages/victor78/yii2-zipper)[ RSS](/packages/victor78-yii2-zipper/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (5)Used By (1)

Yii2-Zipper
===========

[](#yii2-zipper)

[![CI](https://github.com/victor78/yii2-zipper/actions/workflows/ci.yml/badge.svg)](https://github.com/victor78/yii2-zipper/actions/workflows/ci.yml)[![Latest Stable Version](https://camo.githubusercontent.com/7bb957b48083fcd6d27f73ccb7115a2ec6237c13d00f1be564707dcc07e2798b/68747470733a2f2f706f7365722e707567782e6f72672f766963746f7237382f796969322d7a69707065722f762f737461626c65)](https://packagist.org/packages/victor78/yii2-zipper)[![License](https://camo.githubusercontent.com/cbe8ce489bbea413ad6be77c6bb60c0e07dd897f208d27614ff12fd0102ba988/68747470733a2f2f706f7365722e707567782e6f72672f766963746f7237382f796969322d7a69707065722f6c6963656e7365)](https://packagist.org/packages/victor78/yii2-zipper)[![Total Downloads](https://camo.githubusercontent.com/610ecae0dba2cce8615fd34dbac02dc27a6cffa7a48fe48a76dffe93dcc9a396/68747470733a2f2f706f7365722e707567782e6f72672f766963746f7237382f796969322d7a69707065722f646f776e6c6f616473)](https://packagist.org/packages/victor78/yii2-zipper)

Archiving extension for Yii2 Framework - zip, tar, tar.gz, tar.bz2, 7zip (for zip archive with supporting passwords). It's a shell over [ZippyExt](https://github.com/victor78/ZippyExt).

Расширение для архивации в Yii2 Framework - в виде zip, tar, tar.gz, tar.bz2, 7zip (только для zip архива - в том числе с поддержкой паролей).

**English**:

- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [How to use](#how-to-use)

**Русский**:

- [Требования](https://github.com/victor78/yii2-zipper#%D0%A2%D1%80%D0%B5%D0%B1%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F)
- [Установка](https://github.com/victor78/yii2-zipper#%D0%A3%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BA%D0%B0)
- [Настройка](https://github.com/victor78/yii2-zipper#%D0%9D%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0)
- [Как использовать](https://github.com/victor78/yii2-zipper#%D0%9A%D0%B0%D0%BA-%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D1%8C)

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- [Yii2](https://www.yiiframework.com/) framework
- [ZippyExt](https://github.com/victor78/ZippyExt) `^1.0`
- For `zip` type — the `zip` console utility or the PHP `zip` extension.
- For `tar`, `tar.gz`, `tar.bz2` — GNU tar or BSD tar.
- For `7zip` — the `7za` or `7z` binary available in `PATH`.

PHP Compatibility
-----------------

[](#php-compatibility)

yii2-zipperzippy-extPHP1.x^1.08.1–8.30.x~0.0.47.0+Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](https://getcomposer.org/download/).

Either run

```
composer require victor78/yii2-zipper:"^1.0"

```

or add

```
"victor78/yii2-zipper": "^1.0"
```

to the require section of your composer.json.

Configuration
-------------

[](#configuration)

'type' and 'password' are optional.

```
return [
    //....
    'components' => [
        'zipper' => [
            'class' => 'Victor78\Zipper\Zipper', //required
            'type' => '7zip', //or 'zip' (default), 'tar', 'tar.gz', 'tar.bz2'
            'password' => 'password12345', //optional, only for 7zip type
        ],
    ]
];
```

How to use
----------

[](#how-to-use)

To create archive:

```
//files to archive
$files = [
  '/path/to/file1',
  '/path/to/file2',
];
//to create tar archive
$tarArchive = Yii::$app->zipper->create('/tmp/archive.tar', $files, true, 'tar');

//to create zip archive by 7zip with password
$sevenZipArchive = Yii::$app->zipper->create('/tmp/archive.zip', $files, true, '7zip', 'password12345');
//or, if you've configured zipper component like in the example above:
$sevenZipArchive = Yii::$app->zipper->create('/tmp/archive.zip', $files);

$zipArchive = Yii::$app->zipper->create('/tmp/archive.zip', $files, true, 'zip');
```

To open archive and extract:

```
$zipArchive = Yii::$app->zipper->open('/tmp/archive.zip', 'zip');
$tarArchive = Yii::$app->zipper->open('/tmp/archive.tar', 'tar');
$sevenZipArchive = Yii::$app->zipper->open('/tmp/archive.zip', '7zip');
//open 7zip with password
$sevenZipArchiveEncrypted = Yii::$app->zipper->open('/tmp/archive.zip', '7zip', 'password12345');

$zipArchive->extract('/tmp/extracted/');
```

When you configure zipper component with optional properties 'type' and 'password', they will be used as default fourth and fifth parameters in the create method, and as default second and third parameters in the open method. If you use these parameters in the methods explicitly, they will overwrite the properties from the config. You can leave out the properties in the config and the parameters in the methods entirely - in this case Zipper will try to understand which adapter to use, but it doesn't work with a 7zip archive.

Both methods return an Archive object. You can find the details about how to use this object and other information in the documentation of the [ZippyExt](https://github.com/victor78/ZippyExt) library.

Установка
---------

[](#установка)

Предпочтительным способом установки является при помощи [composer](https://getcomposer.org/download/).

Либо командой из консоли

```
composer require victor78/yii2-zipper:"^1.0"

```

либо включением в composer.json в секцию require.

```
"victor78/yii2-zipper": "^1.0"
```

Настройка
---------

[](#настройка)

'type' и 'password' - опциональны.

```
return [
    //....
    'components' => [
        'zipper' => [
            'class' => 'Victor78\Zipper\Zipper', //required
            'type' => '7zip', //или: 'zip' (по умолчанию), 'tar', 'tar.gz', 'tar.bz2'
            'password' => 'password12345', //опционально, работает только при типе 7zip
        ],
    ]
];
```

Как использовать
----------------

[](#как-использовать)

Для создания архива:

```
//files to archive
$files = [
  '/path/to/file1',
  '/path/to/file2',
];
//создать tar архив
$tarArchive = Yii::$app->zipper->create('/tmp/archive.tar', $files, true, 'tar');

//создать zip архив с паролем при помощи 7zip
$sevenZipArchive = Yii::$app->zipper->create('/tmp/archive.zip', $files, true, '7zip', 'password12345');
//или, если вы настроили компонент Zipper как в примере выше:
$sevenZipArchive = Yii::$app->zipper->create('/tmp/archive.zip', $files);

$zipArchive = Yii::$app->zipper->create('/tmp/archive.zip', $files, true, 'zip');
```

Открыть и распаковать архив:

```
$zipArchive = Yii::$app->zipper->open('/tmp/archive.zip', 'zip');
$tarArchive = Yii::$app->zipper->open('/tmp/archive.tar', 'tar');
$sevenZipArchive = Yii::$app->zipper->open('/tmp/archive.zip', '7zip');
//открыть запароленный zip созданный при помощи 7zip
$sevenZipArchiveEncrypted = Yii::$app->zipper->open('/tmp/archive.zip', '7zip', 'password12345');

$zipArchive->extract('/tmp/extracted/');
```

Если вы настроили компонент Zipper с опциональными свойствами 'type' и 'password', они будут использованы как дефолтные четвёртый и пятый параметры в методе create и второй и третий параметры в методе open. Если эти параметры в этих методах указываются явно, то они переписывают свойства из конфига. Вы можете опустить свойства из конфига и параметры в методах вообще - в таком случае Zipper попытается самостоятельно понять какой именно адаптер какого архиватора использовать, но это точно не будет работать в случае zip архива, созданного при помощи 7zip.

Оба метода возвращают объект Archive. Вы можете найти детали о том, как использовать данный объект и другую информацию в документации к библиотеке [ZippyExt](https://github.com/victor78/ZippyExt).

Требования
----------

[](#требования)

- PHP &gt;= 8.1, фреймворк Yii2 и пакет [ZippyExt](https://github.com/victor78/ZippyExt) `^1.0`.
- Для архивирования в чистый zip используется утилита zip или расширение PHP для zip, так что или утилита, или расширение должны быть установлены на сервере для упаковки и распаковки zip.
- Для tar, tar.gz, tar.bz2 Zipper пытается использовать GNU tar или BSD tar, один из них должен быть установлен на сервере для этих типов архивов.
- Для упаковки/распаковки zip при помощи 7zip, на сервере должна быть установлена утилита `7za` или `7z`.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance74

Regular maintenance activity

Popularity30

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity75

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

Every ~989 days

Total

4

Last Release

27d ago

Major Versions

0.0.4 → v1.0.02026-06-07

PHP version history (2 changes)0.0.1PHP &gt;=7.0

v1.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11695079?v=4)[Victor 78](/maintainers/victor78)[@victor78](https://github.com/victor78)

---

Top Contributors

[![victor78](https://avatars.githubusercontent.com/u/11695079?v=4)](https://github.com/victor78 "victor78 (5 commits)")

---

Tags

archivetarzipyii2componentarchiverzippyzipperVictor78

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[umanskyi31/opengraph

Created a new component for Yii2. The Open Graph component for your website

119.8k](/packages/umanskyi31-opengraph)[dlds/yii2-mlm

Yii2 Multi Level Marketing component

173.8k](/packages/dlds-yii2-mlm)

PHPackages © 2026

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