Component providing several adapters to decompress files.
It supports the following compression formats:
- Zip
- Gzip
- Tar (gzip or bzip)
With the following adapters:
PclZip
, based on the PclZip libraryZipArchive
, based on PHP's Zip extensionGzip
, based on PHP's native Gzip functionsTar
, based on the Archive_Tar library from PEAR
With Composer:
{
"require": {
"matomo/decompress": "*"
}
}
All adapters have the same API as they implement Matomo\Decompress\DecompressInterface
:
$extractor = new \Matomo\Decompress\Gzip('file.gz');
$extractedFiles = $extractor->extract('some/directory');
if ($extractedFiles === 0) {
echo $extractor->errorInfo();
}
The Decompress component is released under the LGPL v3.0.