Zip
extends ZipArchive
in package
Table of Contents
- $folderPrefix : string
- add() : self
- Includes a source to the Zip
- extract() : bool
- Extract an existing zip file.
- folder() : self
- Creates a new folder inside the Zip and adds source files (optional)
- make() : self
- Creates a new empty zip file.
- remove() : self
- Removes a file or folder from the zip collection.
- removePathPrefix() : string
- Removes a prefix from a path.
Properties
$folderPrefix
protected
string
$folderPrefix
= ''
Folder prefix
Methods
add()
Includes a source to the Zip
public
add(mixed $source[, array<string|int, mixed> $options = [] ]) : self
Parameters
- $source : mixed
- $options : array<string|int, mixed> = []
Return values
self —extract()
Extract an existing zip file.
public
static extract(string $source, string $destination[, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $source : string
-
Path for the existing zip
- $destination : string
-
Path to extract the zip files
- $options : array<string|int, mixed> = []
Return values
bool —folder()
Creates a new folder inside the Zip and adds source files (optional)
public
folder(string $name[, mixed $source = null ]) : self
Parameters
- $name : string
-
Folder name
- $source : mixed = null
Return values
self —make()
Creates a new empty zip file.
public
static make(string $destination, mixed $source[, array<string|int, mixed> $options = [] ]) : self
Parameters
- $destination : string
-
Path for the new zip
- $source : mixed
- $options : array<string|int, mixed> = []
Return values
self —remove()
Removes a file or folder from the zip collection.
public
remove(string $source) : self
Does not support wildcards.
Parameters
- $source : string
Return values
self —removePathPrefix()
Removes a prefix from a path.
protected
removePathPrefix(string $prefix, string $path) : string
Parameters
- $prefix : string
-
/var/sites/
- $path : string
-
/var/sites/moo/cow/
Return values
string —moo/cow/