digitaledgeit/compression

Library for the compression

0.2.2 2016-03-14 22:54 UTC

This package is not auto-updated.

Last update: 2024-11-20 13:01:47 UTC


README

High level classes for creating compressed archives in PHP.

Example

Add entries to an archive:

$jar = new ZipArchive('test.zip');
$jar
	->addFile($dir.'/package.json', 'package.json')
	->addFolder($dir.'/scripts',    'scripts')
	->close()
;

Iterate entries in an archive:

	$zip = new ZipArchive('test.zip');
	foreach ($zip as $entry) {
		echo $entry->getName().PHP_EOL;
	}
	$zip->close();

Extract entries from an archive:

$zip = new ZipArchive('test.zip');
$zip->extractTo('/tmp'); //all entries
$zip['package.json']->extractTo('/tmp/package.json'); //a single entry
$zip->close();