Zip
extends ZipArchive
in package
Zip class.
Table of Contents
- $checkFiles : bool
- Check files before unpacking.
- $illegalExtensions : array<string|int, mixed>
- Illegal extensions for extract.
- $onlyExtensions : array<string|int, mixed>
- Files extension for extract.
- addDirectory() : mixed
- Copy the directory on the disk into zip file.
- checkFreeSpace() : bool
- Check free disk space.
- createFile() : Zip
- Open file for create zip file.
- download() : mixed
- Push out the file content for download.
- extract() : array<string|int, mixed>
- Simple extract the archive contents.
- getLocalPath() : string
- Get compressed file path.
- isDir() : bool
- Check if the file path is directory.
- openFile() : bool|Zip
- Open file and initialization unpack.
- unzip() : string|array<string|int, string>
- Function to extract files.
- unzipFile() : bool
- Function to extract single file.
- validateFile() : bool
- Check illegal characters.
Properties
$checkFiles
Check files before unpacking.
protected
bool
$checkFiles
= true
$illegalExtensions
Illegal extensions for extract.
protected
array<string|int, mixed>
$illegalExtensions
$onlyExtensions
Files extension for extract.
protected
array<string|int, mixed>
$onlyExtensions
Methods
addDirectory()
Copy the directory on the disk into zip file.
public
addDirectory(string $dir[, string $localName = '' ][, bool $relativePath = false ]) : mixed
Parameters
- $dir : string
- $localName : string = ''
- $relativePath : bool = false
Return values
mixed —checkFreeSpace()
Check free disk space.
public
checkFreeSpace() : bool
Return values
bool —createFile()
Open file for create zip file.
public
static createFile(string $fileName) : Zip
Parameters
- $fileName : string
Tags
Return values
Zip —download()
Push out the file content for download.
public
download(string $name) : mixed
Parameters
- $name : string
Return values
mixed —extract()
Simple extract the archive contents.
public
extract(string $toDir) : array<string|int, mixed>
Parameters
- $toDir : string
Tags
Return values
array<string|int, mixed> —getLocalPath()
Get compressed file path.
public
getLocalPath(string $compressedFileName) : string
Parameters
- $compressedFileName : string
Return values
string —isDir()
Check if the file path is directory.
public
isDir(string $filePath) : bool
Parameters
- $filePath : string
Return values
bool —openFile()
Open file and initialization unpack.
public
static openFile([bool $fileName = false ][, array<string|int, mixed> $options = [] ]) : bool|Zip
Parameters
- $fileName : bool = false
- $options : array<string|int, mixed> = []
Tags
Return values
bool|Zip —unzip()
Function to extract files.
public
unzip( $toDir[, bool $close = true ]) : string|array<string|int, string>
Parameters
Return values
string|array<string|int, string> —Unpacked files
unzipFile()
Function to extract single file.
public
unzipFile(string $compressedFileName, string $targetFileName) : bool
Parameters
- $compressedFileName : string
- $targetFileName : string
Return values
bool —validateFile()
Check illegal characters.
public
validateFile(string $path) : bool
Parameters
- $path : string