2017 © Pedro Peláez
 

library unified-archive

UnifiedArchive - unified interface to all popular archive formats (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.xz, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + PclZip-like interface for zip archives.

image

wapmorgan/unified-archive

UnifiedArchive - unified interface to all popular archive formats (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.xz, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + PclZip-like interface for zip archives.

  • Sunday, June 17, 2018
  • by wapmorgan
  • Repository
  • 13 Watchers
  • 180 Stars
  • 50,410 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 14 Forks
  • 1 Open issues
  • 17 Versions
  • 10 % Grown

The README.md

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)., (*1)

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., (*2)

Latest Stable Version Total Downloads Daily Downloads License Latest Unstable Version, (*3)

Tests & Quality: Scrutinizer Code Quality Code Coverage, (*4)

  1. Functions & Features
  2. How it works
  3. Quick start
  4. Built-in console archive manager
  5. Usage
  6. Drivers & formats
  7. Full API description
  8. Changelog

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)., (*5)

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 for all formats. Easy transition from old PclZip. - Bundled with cli utility, (*6)

Specific functions: - Read (zip, rar) & set (zip) archive comment - Open archives encrypted with password (zip, rar, 7z) - Set passwords (7z, zip) for new archives - Adjust compression level (zip, gzip, 7zip) for new archives, (*7)

How it works

UnifiedArchive uses "drivers", which can be one of types: 1. PHP Extensions 2. Utilities + bridge 3. Pure PHP, (*8)

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., (*9)

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, (*10)

tar format (with compressed variants) supported by: 1. PHP extension: phar 2. Utility + bridge: SevenZip / AlchemyZippy 3. Pure: TarByPear / SplitbrainPhpArchive, (*11)

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., (*12)

Quick start

Installation and configuration

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

#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

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

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:, (*13)

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

The Versions

17/06 2018

0.2.x-dev

0.2.9999999.9999999-dev

UnifiedArchive - unified interface to all popular archive formats (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.xz, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + PclZip-like interface for zip archives.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar wapmorgan

zip archive compression tar iso rar gzip 7z bzip2 cab lzma2 ncompress

17/06 2018

0.1.x-dev

0.1.9999999.9999999-dev

UnifiedArchive - unified interface to all popular archive formats (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.xz, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + PclZip-like interface for zip archives.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar wapmorgan

zip archive compression tar iso rar gzip 7z bzip2 cab lzma2 ncompress

03/06 2018

dev-master

9999999-dev

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar wapmorgan

zip archive compression tar iso rar gzip 7z bzip2 cab lzma2 ncompress

02/04 2018

0.1.0

0.1.0.0

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar wapmorgan

zip archive compression tar iso rar gzip 7z bzip2 cab lzma2 ncompress

25/03 2018

0.1.0-alpha

0.1.0.0-alpha

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avatar wapmorgan

zip archive compression tar iso rar gzip 7z bzip2 cab lzma2 ncompress

21/03 2018

0.0.x-dev

0.0.9999999.9999999-dev

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar wapmorgan

zip archive compression tar iso rar gzip 7z bzip2 cab lzma2 ncompress

19/03 2018

0.0.11

0.0.11.0

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar wapmorgan

zip archive compression tar iso rar gzip 7z bzip2 cab lzma2 ncompress

07/08 2017

0.0.10

0.0.10.0

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar wapmorgan

zip archive compression tar iso rar gzip 7z bzip2 cab lzma2 ncompress

21/07 2017

0.0.9

0.0.9.0

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso) for listing, reading, extracting and creation + built-in console archive manager + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar wapmorgan

zip archive compression tar iso rar gzip 7z bzip2 cab lzma2 ncompress

24/01 2017

0.0.8

0.0.8.0

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, cab, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso-9660) for listing, reading, extracting and creation + built-in console packer and unpacker + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar wapmorgan

zip archive tar rar gzip 7z bzip2 cab lzma2 ncompress iso-9660

14/01 2017

0.0.7

0.0.7.0

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso-9660) for listing, reading, extracting and creation + built-in console packer and unpacker + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar wapmorgan

zip archive tar rar gzip 7z bzip2 lzma2 ncompress iso-9660

09/01 2017

0.0.6

0.0.6.0

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso-9660) for listing, reading, extracting and creation + built-in console packer and unpacker + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar wapmorgan

zip archive tar rar gzip 7z bzip2 lzma2 ncompress iso-9660

08/01 2017

0.0.5

0.0.5.0

UnifiedArchive - unified interface to archive (zip, 7z, rar, gz, bz2, xz, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso-9660) for listing, reading, extracting and creation + built-in console packer and unpacker + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar wapmorgan

zip archive tar rar gzip 7z bzip2 lzma2 ncompress iso-9660

07/01 2017

0.0.4

0.0.4.0

UnifiedArchive - unified interface to archive (zip, rar, gz, bz2, xz, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso-9660) for listing, reading, extracting and creation + built-in console packer and unpacker + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar wapmorgan

zip archive tar rar gzip lzma2 ncompress iso-9660

18/08 2015

0.0.3

0.0.3.0

UnifiedArchive - unified interface to archive (zip, rar, gz, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso-9660) for listing, reading, extracting and creation + built-in console packer and unpacker + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar wapmorgan

zip archive tar rar gzip lzma2 ncompress iso-9660

27/05 2014

0.0.2

0.0.2.0

UnifiedArchive - unified interface to archive (zip, rar, gz, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso-9660) for listing, reading, extracting and creation + built-in console packer and unpacker + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

MIT

The Requires

 

by Avatar wapmorgan

zip archive tar rar gzip lzma2 ncompress iso-9660

26/05 2014

0.0.1

0.0.1.0 https://github.com/wapmorgan/UnifiedArchive

UnifiedArchive - unified interface to archive (zip, rar, gz, tar, tar.gz, tar.bz2, tar.x, tar.Z, iso-9660) for listing, reading, extracting and creation + built-in console packer and unpacker + fully implemented PclZip-like interface (create, listContent, extract, properties, add, delete, merge, duplicate).

  Sources   Download

The Requires

 

by Avatar wapmorgan

zip archive tar rar gzip lzma2 ncompress iso-9660