PHPackages                             wapmorgan/unified-archive - 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. wapmorgan/unified-archive

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

wapmorgan/unified-archive
=========================

UnifiedArchive - an archive manager with unified interface of working with all popular archive formats (zip/7z/rar/gz/bz2/xz/cab/tar/tar.gz/tar.bz2/tar.x/tar.Z/...) for PHP with ability for listing, reading, extracting and creation + built-in console archive manager.

1.3.0(9mo ago)2791.6M↓11.2%24[6 issues](https://github.com/wapmorgan/UnifiedArchive/issues)[1 PRs](https://github.com/wapmorgan/UnifiedArchive/pulls)7MITPHPPHP &gt;=7.1CI failing

Since May 26Pushed 8mo ago12 watchersCompare

[ Source](https://github.com/wapmorgan/UnifiedArchive)[ Packagist](https://packagist.org/packages/wapmorgan/unified-archive)[ RSS](/packages/wapmorgan-unified-archive/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (34)Used By (7)

*UnifiedArchive* - an archive manager with unified interface for different formats that works on wide variety of system configuration. It supports all basic operations on widespread formats and some format-specific features for most popular ones (zip, rar, 7z, tar).

Main purpose of this library is to create unified interface for popular archive formats, that works in various system configurations via different drivers, when there is no ability to update system configuration, when code delivered to another system configurations, or when you just want to install libraries and work. It's handy when there's need to support archive types regardless of the system configuration.

[![Latest Stable Version](https://camo.githubusercontent.com/5826e82664e892d25b8f393a6e6eeccd056ca32da666c78887cc1f313e49bd90/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f756e69666965642d617263686976652f762f737461626c65)](https://packagist.org/packages/wapmorgan/unified-archive)[![Total Downloads](https://camo.githubusercontent.com/a0d5f1f6cece7d25d893fcd5cd89870a3f5f6aef922c63d166b3b6eb45b2eae1/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f756e69666965642d617263686976652f646f776e6c6f616473)](https://packagist.org/packages/wapmorgan/unified-archive)[![Daily Downloads](https://camo.githubusercontent.com/24166bf46ffc3472908f6f493b446df81afd9bec91e91d0a6f4a70fe24fe57b9/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f756e69666965642d617263686976652f642f6461696c79)](https://packagist.org/packages/wapmorgan/unified-archive)[![License](https://camo.githubusercontent.com/00492713fdca4050460318caae9b7836cd94c1fc3358d82c43e3607eeae272e6/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f756e69666965642d617263686976652f6c6963656e7365)](https://packagist.org/packages/wapmorgan/unified-archive)[![Latest Unstable Version](https://camo.githubusercontent.com/f99b6470893bde07bbbb040cd5a0c7b55a47edd07fabfe95b5e4371bda7e46ca/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f756e69666965642d617263686976652f762f756e737461626c65)](https://packagist.org/packages/wapmorgan/unified-archive)

Tests &amp; Quality: [![Scrutinizer Code Quality](https://camo.githubusercontent.com/762be3fb03924c141b8480ad09aba977eb55dba0ccf7c981035c3133c5333099/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7761706d6f7267616e2f556e6966696564417263686976652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/wapmorgan/UnifiedArchive/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/ca3bcf5789a2c2efa558fed01d508f612d0cfe67227650b5cdde4056350ad70f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7761706d6f7267616e2f556e6966696564417263686976652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/wapmorgan/UnifiedArchive/?branch=master)

1. [Functions &amp; Features](#functions--features)
2. [How it works](#how-it-works)
3. [Quick start](#quick-start)
4. [Built-in console archive manager](#built-in-console-archive-manager)
5. [Usage](docs/Usage.md)
6. [Drivers &amp; formats](docs/Drivers.md)
7. [Full API description](docs/API.md)
8. [Changelog](CHANGELOG.md)

Functions &amp; Features
========================

[](#functions--features)

UnifiedArchive is aimed to provide all operations on popular archive formats (zip, tar, rar, 7z) by all means and at better performance (depends on your OS/PHP configuration). Also, it allows to work with less popular archive types (with lack of functions).

Main functions:

- Open an archive with automatic format detection (more 20 formats).
- List archive content, calculate original size of archive
- Get details (original size, date of modification) of every archived file. Extract or stream archived file content
- Extract all archive content. Append an archive with new files or directories. Remove files from archive
- Create new archives with files/directories on disk and stream from memory
- Fully implemented [PclZip-like interface for archives](docs/API.md#UnifiedArchive--getPclZipInterface) for all formats. Easy transition from old PclZip.
- Bundled with cli utility

Specific functions:

- Read (zip, rar) &amp; set (zip) archive comment
- [Open archives encrypted with password (zip, rar, 7z)](docs/API.md#UnifiedArchive--open)
- Set passwords (7z, zip) for new archives
- [Adjust compression level (zip, gzip, 7zip)](docs/API.md#UnifiedArchive--archiveFiles) for new archives

How it works
============

[](#how-it-works)

UnifiedArchive uses "drivers", which can be one of types:

1. PHP Extensions
2. Utilities + bridge
3. Pure PHP

By default, UA goes top-down to select first available driver for passed archive. So, PHP Extension driver will be used (if available), then Utilities + bridge driver (if available), and then Pure PHP driver.

There is at least one driver in all three types, which handles **zip** format, so this format can be fully supported in any OS/PHP configuration:

1. PHP extensions: zip / phar
2. Utility + bridge: SevenZip / AlchemyZippy
3. Pure: NelexaZip / SplitbrainPhpArchive

**tar** format (with compressed variants) supported by:

1. PHP extension: phar
2. Utility + bridge: SevenZip / AlchemyZippy
3. Pure: TarByPear / SplitbrainPhpArchive

**So, there is always one driver that supports popular formats, and you should not remember how to work with this concrete driver (zip/phar/SevenZip/AlchemyZippy/NelexaZip/SplitbrainPhpArchive), interface for them is uniform.**

Quick start
===========

[](#quick-start)

Installation and configuration
------------------------------

[](#installation-and-configuration)

### Install library

[](#install-library)

```
composer require wapmorgan/unified-archive
#Check supported formats with installed drivers
./vendor/bin/cam system:formats
#Check supported functions for zip format
./vendor/bin/cam system:format zip
```

### Install new driver

[](#install-new-driver)

```
#Read installation instructions from
./vendor/bin/cam system:drivers
#install missing drivers, for example pear/archive_tar
composer require pear/archive_tar
#check out driver functions
./vendor/bin/cam system:formats TarByPear

#if needed, install extensions, cli tools and php libraries
#to enable support of other formats
```

Usage
-----

[](#usage)

- [Full usage](docs/Usage.md)
- [Drivers &amp; formats](docs/Drivers.md)
- [Full API description](docs/API.md)
- [Changelog](CHANGELOG.md)

```
use \wapmorgan\UnifiedArchive\UnifiedArchive;
$output_dir = '/var/www/extracted';
# Extraction
$archive = UnifiedArchive::open('archive.zip'); // archive.rar, archive.tar.bz2
if (disk_free_space($output_dir) < $archive->getOriginalSize()) {
    throw new \RuntimeException('No needed space available. Need ' . ($archive->getOriginalSize() - disk_free_space($output_dir)) . ' byte(s) more');
}
$extracted = $archive->extract($output_dir);
echo 'Number of extracted files' . $extracted.PHP_EOL;

# Archiving
UnifiedArchive::create([
    'README.md' => '/default/path/to/README.md',
    '' => '/folder/with/content/',
], 'archive.zip');
```

Built-in console archive manager
================================

[](#built-in-console-archive-manager)

UnifiedArchive is distributed with a unified console program to manipulate archives. It supports all formats and all operations on them that UnifiedArchive does, so it can be used to manipulate archives without other system software. To show help, launch it:

```
./vendor/bin/cam list # help
./vendor/bin/cam archive:info archive.tar.gz # archive information
./vendor/bin/cam files:list -l archive.tar.gz # files list (or files:table for table)
./vendor/bin/cam archive:extract archive.tar.gz ./OUTPUT/ # extraction all archive
./vendor/bin/cam archive:create --compression=maximum archive2.tar.gz ./OUTPUT/partners # archive creation from files
```

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance57

Moderate activity, may be stable

Popularity59

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 95.2% 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 ~127 days

Recently: every ~231 days

Total

33

Last Release

294d ago

Major Versions

0.2.0 → 1.0.02020-06-13

PHP version history (5 changes)0.0.1PHP &gt;=5.3.0

0.1.0-alphaPHP &gt;=5.4.0

0.1.3PHP &gt;=5.5.0

1.2.1PHP &gt;=5.5.0 &lt;8.4.0

1.3.0PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6000618?v=4)[Sergey](/maintainers/wapmorgan)[@wapmorgan](https://github.com/wapmorgan)

---

Top Contributors

[![wapmorgan](https://avatars.githubusercontent.com/u/6000618?v=4)](https://github.com/wapmorgan "wapmorgan (453 commits)")[![cedric-anne](https://avatars.githubusercontent.com/u/33253653?v=4)](https://github.com/cedric-anne "cedric-anne (9 commits)")[![iasjennen](https://avatars.githubusercontent.com/u/12272672?v=4)](https://github.com/iasjennen "iasjennen (3 commits)")[![cod3beat](https://avatars.githubusercontent.com/u/1164982?v=4)](https://github.com/cod3beat "cod3beat (3 commits)")[![wlkns](https://avatars.githubusercontent.com/u/1921583?v=4)](https://github.com/wlkns "wlkns (2 commits)")[![jasonhoule](https://avatars.githubusercontent.com/u/6100590?v=4)](https://github.com/jasonhoule "jasonhoule (2 commits)")[![patie](https://avatars.githubusercontent.com/u/760932?v=4)](https://github.com/patie "patie (1 commits)")[![rotdrop](https://avatars.githubusercontent.com/u/1494769?v=4)](https://github.com/rotdrop "rotdrop (1 commits)")[![Dgame](https://avatars.githubusercontent.com/u/2406877?v=4)](https://github.com/Dgame "Dgame (1 commits)")[![adriannuta](https://avatars.githubusercontent.com/u/956984?v=4)](https://github.com/adriannuta "adriannuta (1 commits)")

---

Tags

7ziparchivesarchivingbz2bzip2cabgzipisolzma2manipulate-archivesrartarzipcompressionarchivetarzipisogzip7zrarlzma2ncompressbzip2cab

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wapmorgan-unified-archive/health.svg)

```
[![Health](https://phpackages.com/badges/wapmorgan-unified-archive/health.svg)](https://phpackages.com/packages/wapmorgan-unified-archive)
```

###  Alternatives

[raulfraile/distill

Smart compressed files extractor

228190.4k9](/packages/raulfraile-distill)[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)[splitbrain/php-archive

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

1061.4M20](/packages/splitbrain-php-archive)[phpzip/phpzip

Package to create and stream archives of compressed files in ZIP format with PHP 5.3+

124840.7k9](/packages/phpzip-phpzip)[pear/archive_tar

Tar file management class with compression support (gzip, bzip2, lzma2)

7661.0M73](/packages/pear-archive-tar)[barracudanetworks/archivestream-php

A library for dynamically streaming dynamic tar or zip files without the need to have the complete file stored on the server.

77192.2k1](/packages/barracudanetworks-archivestream-php)

PHPackages © 2026

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