diff --git a/README.md b/README.md index 6ace165..9e38d84 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ With Composer: ```json { "require": { - "matomo/decompress": "*" + "matomo/decompress": "^2.1" } } ``` @@ -36,10 +36,56 @@ With Composer: All adapters have the same API as they implement `Matomo\Decompress\DecompressInterface`: ```php +// Extracting Gzip file $extractor = new \Matomo\Decompress\Gzip('file.gz'); $extractedFiles = $extractor->extract('some/directory'); +if ($extractedFiles === 0) { + echo $extractor->errorInfo(); +} + +// Extracting Bzip file +$extractor = new \Matomo\Decompress\Bzip('file.bz'); + +$extractedFiles = $extractor->extract('some/directory'); + +if ($extractedFiles === 0) { + echo $extractor->errorInfo(); +} + +// Extracting Zip file with ZipArchive +$extractor = new \Matomo\Decompress\ZipArchive('file.zip'); + +$extractedFiles = $extractor->extract('some/directory'); + +if ($extractedFiles === 0) { + echo $extractor->errorInfo(); +} + +// Extracting Zip file with PclZip +$extractor = new \Matomo\Decompress\PclZip('file.zip'); + +$extractedFiles = $extractor->extract('some/directory'); + +if ($extractedFiles === 0) { + echo $extractor->errorInfo(); +} + +// Extracting .tar.bz2 file +$extractor = new \Matomo\Decompress\Tar('file.tar.bz2', 'bz2'); + +$extractedFiles = $extractor->extract('some/directory'); + +if ($extractedFiles === 0) { + echo $extractor->errorInfo(); +} + +// Extracting .tar.gz file +$extractor = new \Matomo\Decompress\Tar('file.tar.gz', 'gz'); + +$extractedFiles = $extractor->extract('some/directory'); + if ($extractedFiles === 0) { echo $extractor->errorInfo(); }