$zipContainer
$zipContainer : \PhpZip\Model\ZipContainer
Create, open .ZIP files, modify, get info and extract files.
Implemented support traditional PKWARE encryption and WinZip AES encryption. Implemented support ZIP64. Support ZipAlign functional.
$zipContainer : \PhpZip\Model\ZipContainer
$defaultMimeTypes : array
$reader : \PhpZip\IO\ZipReader|null
extractTo(string $destDir, array|string|null $entries = null, array $options = [], array $extractedEntries = []) : \PhpZip\ZipFile
Extract the archive contents (unzip).
Extract the complete archive or the given files to the specified destination.
| string | $destDir | location where to extract the files |
| array|string|null | $entries | entries to extract |
| array | $options | extract options |
| array | $extractedEntries | if the extractedEntries argument is present, then the specified array will be filled with information about the extracted entries |
addFromString(string $entryName, string $contents, int|null $compressionMethod = null) : \PhpZip\ZipFile
Add entry from the string.
| string | $entryName | zip entry name |
| string | $contents | string contents |
| int|null | $compressionMethod | Compression method. Use {@see \PhpZip\Constants\ZipCompressionMethod::STORED}, {@see \PhpZip\Constants\ZipCompressionMethod::DEFLATED} or {@see \PhpZip\Constants\ZipCompressionMethod::BZIP2}. If null, then auto choosing method. |
addFile(string $filename, string|null $entryName = null, int|null $compressionMethod = null) : \PhpZip\ZipFile
Add entry from the file.
| string | $filename | destination file |
| string|null | $entryName | zip Entry name |
| int|null | $compressionMethod | Compression method. Use {@see \PhpZip\Constants\ZipCompressionMethod::STORED}, {@see \PhpZip\Constants\ZipCompressionMethod::DEFLATED} or {@see \PhpZip\Constants\ZipCompressionMethod::BZIP2}. If null, then auto choosing method. |
addFromStream(resource $stream, string $entryName, int|null $compressionMethod = null) : \PhpZip\ZipFile
Add entry from the stream.
| resource | $stream | stream resource |
| string | $entryName | zip Entry name |
| int|null | $compressionMethod | Compression method. Use {@see \PhpZip\Constants\ZipCompressionMethod::STORED}, {@see \PhpZip\Constants\ZipCompressionMethod::DEFLATED} or {@see \PhpZip\Constants\ZipCompressionMethod::BZIP2}. If null, then auto choosing method. |
addDir(string $inputDir, string $localPath = '/', int|null $compressionMethod = null) : \PhpZip\ZipFile
Add directory not recursively to the zip archive.
| string | $inputDir | Input directory |
| string | $localPath | add files to this directory, or the root |
| int|null | $compressionMethod | Compression method.
|
addDirRecursive(string $inputDir, string $localPath = '/', int|null $compressionMethod = null) : \PhpZip\ZipFile
Add recursive directory to the zip archive.
| string | $inputDir | Input directory |
| string | $localPath | add files to this directory, or the root |
| int|null | $compressionMethod | Compression method. Use {@see \PhpZip\Constants\ZipCompressionMethod::STORED}, {@see \PhpZip\Constants\ZipCompressionMethod::DEFLATED} or {@see \PhpZip\Constants\ZipCompressionMethod::BZIP2}. If null, then auto choosing method. |
addFilesFromIterator(\Iterator $iterator, string $localPath = '/', int|null $compressionMethod = null) : \PhpZip\ZipFile
Add directories from directory iterator.
| \Iterator | $iterator | directory iterator |
| string | $localPath | add files to this directory, or the root |
| int|null | $compressionMethod | Compression method. Use {@see \PhpZip\Constants\ZipCompressionMethod::STORED}, {@see \PhpZip\Constants\ZipCompressionMethod::DEFLATED} or {@see \PhpZip\Constants\ZipCompressionMethod::BZIP2}. If null, then auto choosing method. |
addFilesFromGlob(string $inputDir, string $globPattern, string $localPath = '/', int|null $compressionMethod = null) : \PhpZip\ZipFile
Add files from glob pattern.
| string | $inputDir | Input directory |
| string | $globPattern | glob pattern |
| string | $localPath | add files to this directory, or the root |
| int|null | $compressionMethod | Compression method. Use {@see \PhpZip\Constants\ZipCompressionMethod::STORED}, {@see \PhpZip\Constants\ZipCompressionMethod::DEFLATED} or {@see \PhpZip\Constants\ZipCompressionMethod::BZIP2}. If null, then auto choosing method. |
addFilesFromGlobRecursive(string $inputDir, string $globPattern, string $localPath = '/', int|null $compressionMethod = null) : \PhpZip\ZipFile
Add files recursively from glob pattern.
| string | $inputDir | Input directory |
| string | $globPattern | glob pattern |
| string | $localPath | add files to this directory, or the root |
| int|null | $compressionMethod | Compression method. Use {@see \PhpZip\Constants\ZipCompressionMethod::STORED}, {@see \PhpZip\Constants\ZipCompressionMethod::DEFLATED} or {@see \PhpZip\Constants\ZipCompressionMethod::BZIP2}. If null, then auto choosing method. |
setCompressionMethodEntry(string $entryName, int $compressionMethod) : \PhpZip\ZipFile
| string | $entryName | |
| int | $compressionMethod | Compression method. Use {@see \PhpZip\Constants\ZipCompressionMethod::STORED}, {@see \PhpZip\Constants\ZipCompressionMethod::DEFLATED} or {@see \PhpZip\Constants\ZipCompressionMethod::BZIP2}. If null, then auto choosing method. |
setPasswordEntry(string $entryName, string $password, int|null $encryptionMethod = null) : \PhpZip\ZipFile
Sets a new password of an entry defined by its name.
| string | $entryName | |
| string | $password | |
| int|null | $encryptionMethod |
outputAsAttachment(string $outputFilename, string|null $mimeType = null, bool $attachment = true) : mixed
Output .ZIP archive as attachment.
Die after output.
| string | $outputFilename | Output filename |
| string|null | $mimeType | Mime-Type |
| bool | $attachment | Http Header 'Content-Disposition' if true then attachment otherwise inline |
outputAsResponse(\Psr\Http\Message\ResponseInterface $response, string $outputFilename, string|null $mimeType = null, bool $attachment = true) : \Psr\Http\Message\ResponseInterface
Output .ZIP archive as PSR-7 Response.
| \Psr\Http\Message\ResponseInterface | $response | Instance PSR-7 Response |
| string | $outputFilename | Output filename |
| string|null | $mimeType | Mime-Type |
| bool | $attachment | Http Header 'Content-Disposition' if true then attachment otherwise inline |
offsetSet(string $entryName, string|\DirectoryIterator|\SplFileInfo|resource $contents) : mixed
Offset to set.
| string | $entryName | the offset to assign the value to |
| string|\DirectoryIterator|\SplFileInfo|resource | $contents | the value to set |
addGlob(string $inputDir, string $globPattern, string $localPath = '/', bool $recursive = true, int|null $compressionMethod = null) : \PhpZip\ZipFile
Add files from glob pattern.
| string | $inputDir | Input directory |
| string | $globPattern | glob pattern |
| string | $localPath | add files to this directory, or the root |
| bool | $recursive | recursive search |
| int|null | $compressionMethod | Compression method. Use {@see \PhpZip\Constants\ZipCompressionMethod::STORED}, {@see \PhpZip\Constants\ZipCompressionMethod::DEFLATED} or {@see \PhpZip\Constants\ZipCompressionMethod::BZIP2}. If null, then auto choosing method. |
addRegex(string $inputDir, string $regexPattern, string $localPath = '/', bool $recursive = true, int|null $compressionMethod = null) : \PhpZip\ZipFile
Add files from regex pattern.
| string | $inputDir | search files in this directory |
| string | $regexPattern | regex pattern |
| string | $localPath | add files to this directory, or the root |
| bool | $recursive | recursive search |
| int|null | $compressionMethod | Compression method. Use {@see \PhpZip\Constants\ZipCompressionMethod::STORED}, {@see \PhpZip\Constants\ZipCompressionMethod::DEFLATED} or {@see \PhpZip\Constants\ZipCompressionMethod::BZIP2}. If null, then auto choosing method. |