digitaledgeit / compression
Library for the compression
Installs: 3 447
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=5.3
- digitaledgeit/filesystem: ~0.2.0
Requires (Dev)
- phpunit/phpunit: ~3.7
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();