Proposals for installation drivers

June 27, 2025 ยท View on GitHub

TypeProsConsUseful for
PHP ExteniosnFast, supports a lot of functionsSometimes can not support specific functions (e.g. password-protection in zip on old php versions)Use it when possible (when extensions installed)
Utilities + bridgeUses system utilities, so should be fast (and even faster PHP Extensions)Do not support streamingPacking a lot of files / Unpacking the whole archives without streaming
Pure PHPWorks without PHP Extensions or system utilities, can be installed via composer onlyUses a lot of memory, lack of speedFallback method

Proposals for installation drivers

  • In common case:
    • install TarByPear, NelexaZip
    • If installed 7za utility - configure SevenZip driver
    • Else if installed tar or unzip utilities - configure AlchemyZippy driver
  • In docker/on VDS:
    • install all php extensions (zip, rar, phar, zlib, bz2)
    • install utility (7za - p7zip-full on ubuntu) and SevenZip driver

Drivers

PHP extensions

DriverFormatsphp extensionnotes
Zipzip, jarzipsupports password-protection since 7.2.0
Rarrarrarread-only mode
TarByPharzip, tar, tar.gz, tar.bz2pharHas a bug #71966 in ext-phar (related issue) - an archive will ./ in paths cannot be opened.

PHP extensions for compression only

These drivers support only compressed (not archived) data. They support opening, extracting&streaming and creation.

DriverFormatsPHP extension
Bzip.bz2bzip2
Gzip.gzzlib
Lzma.xzxz - 5.x / 7.x

Utilities + bridge

DriverFormatsutility + bridge
SevenZip7z, xz, bzip2, gzip, tar, zip, wim, ar, arj, cab, chm, cpio, cramfs, dmg, ext, fat, gpt, hfs, ihex, iso, lzh, lzma, mbr, msi, nsis, ntfs, qcow2, rar, rpm, squashfs, udf, uefi, vdi, vhd, vmdk, wim, xar, zp7zip (7za) + gemorroj/archive7z
AlchemyZippyzip, tar, tar.gz, tar.bz2zip/tar + alchemy/zippy

If you install SevenZip and AlchemyZippy at the same time:

  1. You should specify symfony/console version before installation to any 3.x.x version: composer require symfony/process:~3.4, because they require different symfony/process versions.
  2. Install archive7z version 4.0.0: composer require gemorroj/archive7z:~4.0

Pure php implementation

Works with binary data in php-land (= eats a lot of memory for big archives).

DriverFormatslibrarynotes
NelexaZipzipnelexa/zip and optionally php-extensions (bz2, fileinfo, iconv, openssl)
SplitbrainPhpArchivezip, tar, tar.gz, tar.bz2splitbrain/php-archive and optionally php-extensions (zlib, bz2)
TarByPeartar, tar.gz, tar.bz2, tar.xz, tar.Zpear/archive_tar and optionally php-extensions (zlib, bzip2, xz - 5.x / 7.xdont support updating archive (deleteFiles)
Cabcabwapmorgan/cab-archiveGetting files content and extraction is supported only on PHP 7.0.22+, 7.1.8+, 7.2.0. Support only opening & extraction
Isoisophpclasses/php-iso-fileSupport only opening & extraction

Full support matrix

Result of ./vendor/bin/cam system:formats when all drivers installed and configured (except of AlchemyZippy):

+-----------------+------------+------+------+------+-------+--------+--------+--------+-----------+-----+-----+-----+------+-----+-----+-----+-----+-----+-----+-----+------+-------+
| driver / format | zip        | rar  | gz   | bz2  | xz    | tar    | tgz    | tbz2   | 7z        | cab | iso | arj | uefi | gpt | mbr | msi | dmg | rpm | deb | udf | txz  | tar.z |
+-----------------+------------+------+------+------+-------+--------+--------+--------+-----------+-----+-----+-----+------+-----+-----+-----+-----+-----+-----+-----+------+-------+
| Zip             | oOtxsadTcC |      |      |      |       |        |        |        |           |     |     |     |      |     |     |     |     |     |     |     |      |       |
| Rar             |            | oOxs |      |      |       |        |        |        |           |     |     |     |      |     |     |     |     |     |     |     |      |       |
| Gzip            |            |      | oxsc |      |       |        |        |        |           |     |     |     |      |     |     |     |     |     |     |     |      |       |
| Bzip            |            |      |      | oxsc |       |        |        |        |           |     |     |     |      |     |     |     |     |     |     |     |      |       |
| Lzma            |            |      |      |      | oxsc  |        |        |        |           |     |     |     |      |     |     |     |     |     |     |     |      |       |
| TarByPhar       | oxsadc     |      |      |      |       | oxsadc | oxsadc | oxsadc |           |     |     |     |      |     |     |     |     |     |     |     |      |       |
| SevenZip        | oOxadcC    |      |      |      |       | oxadc  |        |        | oOtxadTcC | ox  | ox  | ox  | ox   | ox  | ox  | ox  | ox  | ox  | ox  | ox  |      |       |
| AlchemyZippy    |            |      |      |      |       |        |        |        |           |     |     |     |      |     |     |     |     |     |     |     |      |       |
| NelexaZip       | oOxad      |      |      |      |       |        |        |        |           |     |     |     |      |     |     |     |     |     |     |     |      |       |
| TarByPear       |            |      |      |      |       | oxac   | oxac   | oxac   |           |     |     |     |      |     |     |     |     |     |     |     | oxac |       |
| Iso             |            |      |      |      |       |        |        |        |           |     | ox  |     |      |     |     |     |     |     |     |     |      |       |
| Cab             |            |      |      |      |       |        |        |        |           | ox  |     |     |      |     |     |     |     |     |     |     |      |       |
+-----------------+------------+------+------+------+-------+--------+--------+--------+-----------+-----+-----+-----+------+-----+-----+-----+-----+-----+-----+-----+------+-------+
  • o - open
  • O - open (+password)
  • t - get comment
  • x - extract
  • s - stream
  • a - append
  • d - delete
  • T - set comment
  • c - create
  • C - create (+password)