PHP provides ZipArchive
Class which allows us to create a Zip file. This class makes file creation easier.
Programmatically Zip creation is mainly required when preparing the group of files and folders for downloading.
In the example, I am creating a function that will read all files and folders from the specified directory and add them to the ZipArchive class object.