public static function dir($sourcePath, $outZipPath)
    {
        $sourcePath = rtrim($sourcePath, "/");
        $zip = new ZipArchive();
        $zip->open($outZipPath, ZipArchive::CREATE);
        self::folderToZip($sourcePath, $zip, strlen($sourcePath . "/"));
        $zip->close();
    }
public static function dir($sourcePath, $outZipPath)
    {
        $sourcePath = rtrim($sourcePath, "/");
        $zip = new ZipArchive();
        $zip->open($outZipPath, ZipArchive::CREATE);
        self::folderToZip($sourcePath, $zip, strlen($sourcePath . "/"));
        $zip->close();
    }
public static function dir ( $ sourcePath , $ outZipPath ) { $ sourcePath = rtrim ( $ sourcePath , "/" ) ; $ zip = new ZipArchive ( ) ; $ zip -> open ( $ outZipPath , ZipArchive :: CREATE ) ; self :: folderToZip ( $ sourcePath , $ zip , strlen ( $ sourcePath . "/" ) ) ; $ zip -> close ( ) ; }
Zip a folder

@param string $sourcePath Path of directory to be zip.
@param string $outZipPath Path of output zip file.
Zip a folder