2017 © Pedro Peláez
 

library php-archive

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

image

splitbrain/php-archive

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

  • Tuesday, June 12, 2018
  • by splitbrain
  • Repository
  • 7 Watchers
  • 49 Stars
  • 56,559 Installations
  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 19 Forks
  • 7 Open issues
  • 14 Versions
  • 14 % Grown

The README.md

PHPArchive - Pure PHP ZIP and TAR handling

This library allows to handle new ZIP and TAR archives without the need for any special PHP extensions (gz and bzip are needed for compression). It can create new files or extract existing ones., (*1)

To keep things simple, the modification (adding or removing files) of existing archives is not supported., (*2)

Install

Use composer:, (*3)

php composer.phar require splitbrain/php-archive, (*4)

Usage

The usage for the Zip and Tar classes are basically the same. Here are some examples for working with TARs to get you started., (*5)

Check the API docs for more info., (*6)

require_once 'vendor/autoload.php';
use splitbrain\PHPArchive\Tar;

// To list the contents of an existing TAR archive, open() it and use
// contents() on it:
$tar = new Tar();
$tar->open('myfile.tgz');
$toc = $tar->contents();
print_r($toc); // array of FileInfo objects

// To extract the contents of an existing TAR archive, open() it and use
// extract() on it:
$tar = new Tar();
$tar->open('myfile.tgz');
$tar->extract('/tmp');

// To create a new TAR archive directly on the filesystem (low memory
// requirements), create() it:
$tar = new Tar();
$tar->create('myfile.tgz');
$tar->addFile(...);
$tar->addData(...);
...
$tar->close();

// To create a TAR archive directly in memory, create() it, add*()
// files and then either save() or getArchive() it:
$tar = new Tar();
$tar->setCompression(9, Archive::COMPRESS_BZIP);
$tar->create();
$tar->addFile(...);
$tar->addData(...);
...
$tar->save('myfile.tbz'); // compresses and saves it
echo $tar->getArchive(); // compresses and returns it

Differences between Tar and Zip: Tars are compressed as a whole, while Zips compress each file individually. Therefore you can call setCompression before each addFile() and addData() function call., (*7)

The FileInfo class can be used to specify additional info like ownership or permissions when adding a file to an archive., (*8)

The Versions

12/06 2018

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

extract zip archive tar unzip unpack

12/06 2018

1.1.0

1.1.0.0

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

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

extract zip archive tar unzip unpack

01/05 2018

1.0.10

1.0.10.0

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

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

extract zip archive tar unzip unpack

11/06 2017

1.0.9

1.0.9.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack

19/03 2017

1.0.8

1.0.8.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack

19/03 2017

dev-pull-request-17

dev-pull-request-17

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack

12/08 2015

1.0.7

1.0.7.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack

12/08 2015

1.0.6

1.0.6.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack

12/08 2015

1.0.5

1.0.5.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack

24/07 2015

1.0.4

1.0.4.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack

24/07 2015

1.0.3

1.0.3.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack

30/06 2015

1.0.2

1.0.2.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack

30/06 2015

1.0.1

1.0.1.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack

25/02 2015

1.0.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

extract zip archive tar unzip unpack