public static function zipFolder($folderPath, $zipFilePath = false, $addition = false) { if (!is_dir($folderPath)) { return false; } if ($handle = opendir($folderPath)) { while (false !== ($file = readdir($handle))) { if (!is_dir($folderPath . $file)) { self::$folderFiles[] = $folderPath . $file; } elseif ($file != '.' && $file != '..') { self::zipFolder($folderPath . $file . '/'); } } } if (is_array($addition)) { self::$folderFiles = array_merge(self::$folderFiles, $addition); } if ($zipFilePath) { return self::zipWrite(self::$folderFiles, $zipFilePath); } else { return self::$folderFiles; } }