Recently I had to write a script to create a zip file containing different files and folders. PHP has a ZipArchive class which can be used easily to create zip files. In this article we will see how to create zip files in PHP. We will create different zip files from different files and folders.
- Create a new zip file
- Overwrite an existing zip file
- Create a new zip file and add files to be inside a folder
- Create a new zip file and move the files to be in different folders
- Create a zip file with all files from a directory
- Add multiple files and directories to a zip file