This is a simple wrapper for the ZipArchive method with some convenient features.
Install dependencies using Composer
composer require chumper/zipper
Post-installation configuration
Register the service provider in the providers array in config/app.php:
Chumper\Zipper\ZipperServiceProvider::class
Also, register the facade in the aliases array in config/app.php:
'Zipper' => Chumper\Zipper\Zipper::class
Compressing files
use Zipper;
$arr = glob(public_path($public_path)); //$public_path is the filename to be compressed
Zipper::make(public_path($reduce_path))->add($arr)->close(); //public_path($reduce_path) is the filename after compression
Note:
$public_path = 'aaa.txt';
$reduce_path = 'ddd.zip';
Extracting files
Extracting files
use Zipper;
Zipper::make(path_to_compressed_file)->extractTo(path_for_extracted_files);
Top comments (1)
Why use a package that has been archived for 6 years?