METHOD_STORED
METHOD_STORED = \PhpZip\Constants\ZipCompressionMethod::STORED
Method for Stored (uncompressed) entries.
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.
METHOD_DEFLATED = \PhpZip\Constants\ZipCompressionMethod::DEFLATED
Method for Deflated compressed entries.
None found |
METHOD_BZIP2 = \PhpZip\Constants\ZipCompressionMethod::BZIP2
Method for BZIP2 compressed entries.
Require php extension bz2.
None found |
LEVEL_DEFAULT_COMPRESSION = \PhpZip\Constants\ZipCompressionLevel::NORMAL : int
None found |
LEVEL_FAST = \PhpZip\Constants\ZipCompressionLevel::FAST
Compression level for fastest compression.
None found |
LEVEL_BEST_SPEED = \PhpZip\Constants\ZipCompressionLevel::SUPER_FAST
Compression level for fastest compression.
None found |
None found |
LEVEL_BEST_COMPRESSION = \PhpZip\Constants\ZipCompressionLevel::MAXIMUM
Compression level for best compression.
None found |
ENCRYPTION_METHOD_TRADITIONAL = \PhpZip\Constants\ZipEncryptionMethod::PKWARE
No specified method for set encryption method to Traditional PKWARE encryption.
None found |
ENCRYPTION_METHOD_WINZIP_AES = \PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256
No specified method for set encryption method to WinZip AES encryption.
Default value 256 bit.
None found |
ENCRYPTION_METHOD_WINZIP_AES_128 = \PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_128
No specified method for set encryption method to WinZip AES encryption 128 bit.
None found |
ENCRYPTION_METHOD_WINZIP_AES_192 = \PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_192
No specified method for set encryption method to WinZip AES encryption 194 bit.
None found |
ENCRYPTION_METHOD_WINZIP_AES_256 = \PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256
No specified method for set encryption method to WinZip AES encryption 256 bit.
None found |
openFile(string $filename, array $options = []) : \PhpZip\ZipFile
Open zip archive from file.
string | $filename | |
array | $options |
if can't open file
None found |
openFromString(string $data, array $options = []) : \PhpZip\ZipFile
Open zip archive from raw string data.
string | $data | |
array | $options |
if can't open temp stream
None found |
openFromStream(resource $handle, array $options = []) : \PhpZip\ZipFile
Open zip archive from stream resource.
resource | $handle | |
array | $options |
None found |
None found |
None found |
getArchiveComment() : string|null
Returns the file comment.
the file comment
None found |
setArchiveComment(string|null $comment = null) : \PhpZip\ZipFile
Set archive comment.
string|null | $comment |
None found |
hasEntry(string $entryName) : bool
Checks if there is an entry in the archive.
string | $entryName |
None found |
getEntry(string $entryName) : \PhpZip\Model\ZipEntry
Returns ZipEntry object.
string | $entryName |
None found |
isDirectory(string $entryName) : bool
Checks that the entry in the archive is a directory.
Returns true if and only if this ZIP entry represents a directory entry (i.e. end with '/').
string | $entryName |
None found |
getEntryComment(string $entryName) : string
Returns entry comment.
string | $entryName |
None found |
setEntryComment(string $entryName, string|null $comment = null) : \PhpZip\ZipFile
Set entry comment.
string | $entryName | |
string|null | $comment |
None found |
getEntryContents(string $entryName) : string
Returns the entry contents.
string | $entryName |
None found |
getEntryStream(string $entryName) : resource
string | $entryName |
None found |
getEntryInfo(string|\PhpZip\Model\ZipEntry $entryName) : \PhpZip\Model\ZipInfo
Get info by entry.
string|\PhpZip\Model\ZipEntry | $entryName |
None found |
getAllInfo() : \PhpZip\Model\ZipInfo[]
Get info by all entries.
None found |
None found |
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 |
None found |
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. |
None found |
addFromFinder(\Symfony\Component\Finder\Finder $finder, array $options = []) : \PhpZip\Model\ZipEntry[]
\Symfony\Component\Finder\Finder | $finder | |
array | $options |
None found |
addSplFile(\SplFileInfo $file, string|null $entryName = null, array $options = []) : \PhpZip\Model\ZipEntry
\SplFileInfo | $file | |
string|null | $entryName | |
array | $options |
None found |
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. |
None found |
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. |
None found |
addEmptyDir(string $dirName) : \PhpZip\ZipFile
Add an empty directory in the zip archive.
string | $dirName |
None found |
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.
|
None found |
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. |
None found |
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. |
None found |
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. |
sse |
https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax |
---|
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. |
sse |
https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax |
---|
addAll(array $mapData) : mixed
Add array data to archive.
Keys is local names. Values is contents.
array | $mapData | associative array for added to zip |
None found |
rename(string $oldName, string $newName) : \PhpZip\ZipFile
Rename the entry.
string | $oldName | old entry name |
string | $newName | new entry name |
None found |
deleteFromName(string $entryName) : \PhpZip\ZipFile
Delete entry by name.
string | $entryName | zip Entry name |
if entry not found
None found |
deleteFromGlob(string $globPattern) : \PhpZip\ZipFile
Delete entries by glob pattern.
string | $globPattern | Glob pattern |
sse |
https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax |
---|
deleteFromRegex(string $regexPattern) : \PhpZip\ZipFile
Delete entries by regex pattern.
string | $regexPattern | Regex pattern |
None found |
None found |
setCompressionLevel(int $compressionLevel = ZipCompressionLevel::NORMAL) : \PhpZip\ZipFile
Set compression level for new entries.
int | $compressionLevel |
None found |
setCompressionLevelEntry(string $entryName, int $compressionLevel) : \PhpZip\ZipFile
string | $entryName | |
int | $compressionLevel |
None found |
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. |
None found |
setZipAlign(int|null $align = null) : \PhpZip\ZipFile
zipalign is optimization to Android application (APK) files.
int|null | $align |
None found |
setReadPassword(string $password) : \PhpZip\ZipFile
Set password to all input encrypted entries.
string | $password | Password |
None found |
setReadPasswordEntry(string $entryName, string $password) : \PhpZip\ZipFile
Set password to concrete input entry.
string | $entryName | |
string | $password | Password |
None found |
setPassword(string $password, int|null $encryptionMethod = ZipEncryptionMethod::WINZIP_AES_256) : \PhpZip\ZipFile
Sets a new password for all files in the archive.
string | $password | Password |
int|null | $encryptionMethod | Encryption method |
None found |
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 |
None found |
disableEncryption() : \PhpZip\ZipFile
Disable encryption for all entries that are already in the archive.
None found |
disableEncryptionEntry(string $entryName) : \PhpZip\ZipFile
Disable encryption of an entry defined by its name.
string | $entryName |
None found |
unchangeAll() : \PhpZip\ZipFile
Undo all changes done in the archive.
None found |
unchangeArchiveComment() : \PhpZip\ZipFile
Undo change archive comment.
None found |
unchangeEntry(string|\PhpZip\Model\ZipEntry $entry) : \PhpZip\ZipFile
Revert all changes done to an entry with the given name.
string|\PhpZip\Model\ZipEntry | $entry | Entry name or ZipEntry |
None found |
saveAsFile(string $filename) : \PhpZip\ZipFile
Save as file.
string | $filename | Output filename |
None found |
saveAsStream(resource $handle) : \PhpZip\ZipFile
Save as stream.
resource | $handle | Output stream resource |
None found |
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 |
None found |
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 |
None found |
outputAsString() : string
Returns the zip archive as a string.
None found |
None found |
rewrite() : \PhpZip\ZipFile
Save and reopen zip archive.
None found |
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 |
None found |
offsetUnset(string $entryName) : mixed
Offset to unset.
string | $entryName | the offset to unset |
None found |
current() : mixed
Return the current element.
can return any type
since | 5.0.0 |
---|
offsetGet(string $entryName) : string|null
Offset to retrieve.
string | $entryName | the offset to retrieve |
None found |
key() : mixed
Return the key of the current element.
scalar on success, or null on failure
since | 5.0.0 |
---|
since | 5.0.0 |
---|
valid() : bool
Checks if current position is valid.
The return value will be casted to boolean and then evaluated. Returns true on success or false on failure.
since | 5.0.0 |
---|
offsetExists(string $entryName) : bool
Whether a offset exists.
string | $entryName | an offset to check for |
true on success or false on failure. The return value will be casted to boolean if non-boolean was returned.
None found |
since | 5.0.0 |
---|