Zip
class Zip implements ZipInterface, Countable (View source)
comodojo/zip - ZipArchive toolbox
Traits
Methods
Set current base path (to add relative files to zip archive)
Class constructor
Open a zip archive (static constructor)
Check a zip archive (static constructor)
Create a new zip archive (static constructor)
Count the number of files in the archive
Get current zip file
Get the list of files in the archive as an array
Extract files from zip archive
Add files to the ZipArchive
Delete files from ZipArchive
Close the ZipArchive
Details
ZipInterface
setSkipMode(string $mode)
Set files to skip
Supported skip modes: Zip::SKIP_NONE - skip no files Zip::SKIP_HIDDEN - skip hidden files Zip::SKIP_ALL - skip HIDDEN + COMODOJO ghost files Zip::SKIP_COMODOJO - skip comodojo ghost files
string
getSkipMode()
Get current skip mode
ZipInterface
setMask(int $mask)
Set the mask of the extraction folder
int
getMask()
Get current mask of the extraction folder
abstract ZipArchive|null
getArchive()
ZipInterface
setPassword(string $password)
Set zip password
protected string|null
getPassword()
Get current zip password
ZipInterface
setPath(string|null $path = null)
Set current base path (to add relative files to zip archive)
string|null
getPath()
Get current base path
ZipInterface
setArchive(ZipArchive $zip)
Set the current ZipArchive object
ZipInterface
setComment(string $comment)
Set the comment for the current archive
string|null
getComment()
Get the current zip archive comment
__construct(string $zip_file)
Class constructor
static ZipInterface
open(string $zip_file)
Open a zip archive (static constructor)
static bool
check(string $zip_file)
Check a zip archive (static constructor)
static ZipInterface
create(string $zip_file, bool $overwrite = false)
Create a new zip archive (static constructor)
int
count()
Count the number of files in the archive
string
getZipFile()
Get current zip file
array
listFiles()
Get the list of files in the archive as an array
bool
extract(string $destination, mixed $files = null)
Extract files from zip archive
ZipInterface
add(mixed $file_name_or_array, bool $flatten_root_folder = false, int $compression = self::CM_DEFAULT, int $encryption = self::EM_NONE)
Add files to the ZipArchive
ZipInterface
delete(mixed $file_name_or_array)
Delete files from ZipArchive
bool
close()
Close the ZipArchive