public static function folderToZip($folder, &$zipFile, $exclusiveLength, $exclude = array('.git'), $prefix = '') {
	if (!file_exists($folder)) return;
    $handle = opendir($folder);
    while (false !== $f = readdir($handle)) {
      if ($f != '.' && $f != '..') {
		  
		if (in_array($f, $exclude)) continue;
		  
        $filePath = "$folder/$f";
        // Remove prefix from file path before add to zip.
        $localPath = $prefix.substr($filePath, $exclusiveLength);
        if (is_file($filePath)) {
          $zipFile->addFile($filePath, $localPath);
        } elseif (is_dir($filePath)) {
          // Add sub-directory.
          $zipFile->addEmptyDir($localPath);
          self::folderToZip($filePath, $zipFile, $exclusiveLength, $exclude, $prefix);
        }
      }
    }
    closedir($handle);
  }