Laravel 5 Extract zip/archive file using chumper/zipper composer package.

How to extract zip file using Laravel `chumper/zipper` package step by step. Let’s, first of all, install “chumper/zipper” package. So, Open command prompt and goto the root directory of the Laravel and fire below command.

composer require chumper/zipper

After installing the package open the app config file from “config/app.php” file then append below Provides and Aliases to app.php file.

'providers' => [
    'Chumper\Zipper\ZipperServiceProvider',
],
'aliases' => [
    'Zipper' => 'Chumper\Zipper\Zipper'
],

You can now access Zipper with the Zipper alias for extracting the zip file. So let’s extract zip file. Make sure you have the “test.zip” file inside of the public directory and Also make sure the “thecodingstuff” directory exists inside of the public directory. If not exists please create both file and directory.

Then used below code for extract the zip file of images.

public function extractZip()
{
    $zipPath = public_path('test.zip');
    \Zipper::make($zipPath)->extractTo('thecodingstuff')->close();
}

If you face any issue after using above code written the comment below.