DEV Community

techdurjoy
techdurjoy

Posted on

Create Zip and Download Code Example in Laravel

In this tutorial, i am writing example of laravel 7/6 create zip archive file and download in response. i will give you example step by step how to create zip file from folder and download in laravel 7/6. we will create zip file using ziparchive class in php laravel 7/6 application.

I also post few months ago how to create zip file using composer package in laravel 5. if you want to create zip file using another composer package then you can follow this tutorial: Laravel 5 create and download zip file example using zipper.

But i will highly recommended to create zip archive file without using anymore composer package, because you can easily make zip file using php ziparchive class. ziparchive class provide method to add files so you can easily add files with relative path, so you can easily create folder inside your zip file.

In this post, i will show you how to create very simple way to zip file in laravel 6 application. So let's follow few things and make it simple example.
https://www.codecheef.org/article/recursively-download-multiple-files-as-a-zip-file-in-laravel

Top comments (0)