src/IronWorker.php
public static function zipDirectory($directory, $destination, $overwrite = false, $ignored = [])
    {
        if (!file_exists($directory) || !is_dir($directory)) {
            return false;
        }
        $directory = rtrim($directory, DIRECTORY_SEPARATOR);

        $files = self::fileNamesRecursive($directory, '', $ignored);

        if (empty($files)) {
            return false;
        }

        return self::createZip($directory, $files, $destination, $overwrite);
    }
public static function zipDirectory($directory, $destination, $overwrite = false, $ignored = [])
    {
        if (!file_exists($directory) || !is_dir($directory)) {
            return false;
        }
        $directory = rtrim($directory, DIRECTORY_SEPARATOR);

        $files = self::fileNamesRecursive($directory, '', $ignored);

        if (empty($files)) {
            return false;
        }

        return self::createZip($directory, $files, $destination, $overwrite);
    }
public static function zipDirectory ( $ directory , $ destination , $ overwrite = false , $ ignored = [ ] ) { if ( ! file_exists ( $ directory ) || ! is_dir ( $ directory ) ) { return false ; } $ directory = rtrim ( $ directory , DIRECTORY_SEPARATOR ) ; $ files = self :: fileNamesRecursive ( $ directory , '' , $ ignored ) ; if ( empty ( $ files ) ) { return false ; } return self :: createZip ( $ directory , $ files , $ destination , $ overwrite ) ; }
Creates a zip archive with all files and folders inside specific directory except for the list of ignored files.

Example:
<code>
IronWorker::zipDirectory(dirname(__FILE__)."/worker/", 'worker.zip', true);
</code>

@static
@param string $directory
@param string $destination
@param bool $overwrite
@param array $ignored
@return bool
Creates a zip archive with all files and folders inside specific directory except for the list of ignored files .