https://github.com/digitaledgeit/php-compression
High level classes for creating compressed archives in PHP.
https://github.com/digitaledgeit/php-compression
Last synced: 4 months ago
JSON representation
High level classes for creating compressed archives in PHP.
- Host: GitHub
- URL: https://github.com/digitaledgeit/php-compression
- Owner: digitaledgeit
- Created: 2013-11-18T04:53:26.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-03-18T07:49:39.000Z (about 10 years ago)
- Last Synced: 2025-08-06T23:19:06.141Z (10 months ago)
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# php-compression
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();