Zip
class Zip (View source)
Wrapper for ZIP functions.
Properties
protected Filesystem | $filesystem | The Filesystem instance to use. |
|
protected FunctionInspector | $functionInspector | The FunctionInspector instance to use. |
|
protected bool | $enableNativeCommands | Can we try to use native commands? |
|
protected array | $availableNativeCommands | Cache for the available native commands. |
Methods
Set the Filesystem instance to use.
Get the Filesystem instance to use.
State that we can try to use native commands.
State that we can NOT try to use native commands.
Can we try to use native commands?
Check if a native command is available.
Check if a native command is available and if we may use it.
Decompress a ZIP archive to a directory.
Compress the contents of a directory to a ZIP archive.
List the contents of a ZIP archive.
Describe a ZipArchive related problem.
Decompress a ZIP archive to a directory using the native 'unzip' command.
Decompress a ZIP archive to a directory using the PHP functions.
Compress the contents of a directory to a ZIP archive using the native 'zip' command.
Compress the contents of a directory to a ZIP archive using the PHP functions.
Details
__construct(Filesystem $filesystem, FunctionInspector $functionInspector)
Initialize the instance.
setFilesystem(Filesystem $filesystem)
Set the Filesystem instance to use.
Filesystem
getFilesystem()
Get the Filesystem instance to use.
enableNativeCommands()
State that we can try to use native commands.
disableNativeCommands()
State that we can NOT try to use native commands.
bool
nativeCommandsEnabled()
Can we try to use native commands?
bool
isNativeCommandAvailable(string $command)
Check if a native command is available.
protected bool
mayUseNativeCommand(string $command)
Check if a native command is available and if we may use it.
unzip(string $zipFile, string $destinationDirectory, array $options = [])
Decompress a ZIP archive to a directory.
zip(string $sourceDirectory, string $zipFile, array $options = [])
Compress the contents of a directory to a ZIP archive.
array
listContents(string $zipFile, array $options = [])
List the contents of a ZIP archive.
protected string
describeZipArchiveError(ZipArchive $zip, int $errorCode)
Describe a ZipArchive related problem.
protected
unzipNative(string $zipFile, string $destinationDirectory, array $options)
Decompress a ZIP archive to a directory using the native 'unzip' command.
protected
unzipPHP(string $zipFile, string $destinationDirectory, array $options)
Decompress a ZIP archive to a directory using the PHP functions.
protected
zipNative(string $sourceDirectory, string $zipFile, array $options)
Compress the contents of a directory to a ZIP archive using the native 'zip' command.
protected
zipPHP(string $sourceDirectory, string $zipFile, array $options)
Compress the contents of a directory to a ZIP archive using the PHP functions.