Level 1
I had the same issue so I used the php built-in zip functions.
//The packs of data I want to zip
$pack = array();
$file_path = storage_path("packs/".$pack->name);
//Get the name of all the files in that folder
$files = scandir($file_path);
//Make the Zip
$zip = new ZipArchive();
$filename = "./".$pack->name.".zip";
//If there is an issue... close
if ($zip->open($filename, ZipArchive::CREATE)!==TRUE) {
exit("cannot open <$filename>\n");
}else{
foreach($files as $file){
$zip->addFile($file_path."/".$file,$file);
//echo "numfiles: " . $zip->numFiles . "\n";
//echo "status:" . $zip->status . "\n";
dump($file_path."/".$file);
}
exit();
$zip->close();
}