Tag

Zip

Browsing

Today, We are going to learn Laravel Extract zip/archive file using chumper/zipper. In the last article, we will learn how to create a zip file.  Also, We are going to use chumper zipper package to extract the zip file. First of all, We are going to install the package by the following command.

Laravel Extract zip/archive file using chumper/zipper

Once the package has installed we have to update the Providers and Aliases. Let’s open the config “config/app.php” file then append the Providers and Aliases like below.

The Chumper Zipper package is ready to use. Now, We going to extract the zip file. Let’s create the function to extract the zip file.

First of all, I get the zip file path for passing the first argument on the Zipper function. As a second argument, You should pass the valid directory where you want to extract the zip file. Now, run the code and check the zip file is an extract or not.

If you face any issue on extract zip file please write the comment below.

Today, We are going to learn how to Download zip file from URL using PHP. PHP download archive file using single line of code. We can easily download the any file using PHP single line of code. We use file_put_contents for download file.

PHP Download Archive file

You can download any types of file using this function like JPG, JPEG, EXE, PNG, MP4, MP3 etc…

This trick is very useful when you want to move project to new server. We don’t need to download project to local system and then upload it to new server. Just create zip file of the project and create PHP script to new server then directly download project file on new server using PHP script.

If you face any problem after using this code please write a comment.