diff options
author | Andreas Gohr <andi@splitbrain.org> | 2015-05-16 11:47:11 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2015-05-16 11:47:11 +0200 |
commit | 89167b55d9da5a67be5678038be7a474e5956dbd (patch) | |
tree | d41dcbca53dba23d71b300782805c5f5314e5cfa /vendor/splitbrain/php-archive/README.md | |
parent | 38175ed45a1a1684e8da55d0f5cd825ee4804c3d (diff) | |
parent | 313d3e75d6e76a2d4336143256b8d0b8777e2849 (diff) | |
download | rpg-89167b55d9da5a67be5678038be7a474e5956dbd.tar.gz rpg-89167b55d9da5a67be5678038be7a474e5956dbd.tar.bz2 |
Merge pull request #1152 from splitbrain/composer
Use composer to add 3rd party libs
Diffstat (limited to 'vendor/splitbrain/php-archive/README.md')
-rw-r--r-- | vendor/splitbrain/php-archive/README.md | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/vendor/splitbrain/php-archive/README.md b/vendor/splitbrain/php-archive/README.md new file mode 100644 index 000000000..4fb673259 --- /dev/null +++ b/vendor/splitbrain/php-archive/README.md @@ -0,0 +1,61 @@ +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. + +To keep things simple, the modification (adding or removing files) of existing archives is not supported. + +[](https://travis-ci.org/splitbrain/php-archive) + +Install +------- + +Use composer: + +```php composer.phar require splitbrain/php-archive``` + +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. Check the source code comments for more info + +```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 getData() it: +$tar = new Tar(); +$tar->create(); +$tar->addFile(...); +$tar->addData(...); +... +$tar->save('myfile.tgz'); // compresses and saves it +echo $tar->getArchive(Archive::COMPRESS_GZIP); // 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()``` functions. + +The FileInfo class can be used to specify additional info like ownership or permissions when adding a file to +an archive.
\ No newline at end of file |