Oihana PHP

ZipOption uses ConstantsTrait

Enumeration of the option keys accepted by the `oihana\files\archive\zip` helpers ({@see \oihana\files\archive\zip\zip()}, {@see \oihana\files\archive\zip\zipDirectory()} and {@see \oihana\files\archive\zip\unzip()}).

Tags
author

Marc Alcaraz (ekameleon)

since
1.2.0

Table of Contents

Constants

ALLOW_UNSAFE_LINKS  : string = 'allowUnsafeLinks'
Whether to create a symbolic link whose target leaves the extraction directory.
COMPRESSION  : string = 'compression'
Compression method applied to each entry when creating an archive.
DRY_RUN  : string = 'dryRun'
Return the list of entries instead of extracting them.
EXCLUDE  : string = 'exclude'
List of glob patterns or file names to exclude.
FILTER  : string = 'filter'
Filter the files or directories to archive with a function (string $filepath): bool
KEEP_PERMISSIONS  : string = 'keepPermissions'
Keep the Unix permissions of the files/directories.
MAX_ENTRIES  : string = 'maxEntries'
Maximum number of entries allowed in the archive (decompression-bomb guard).
MAX_SIZE  : string = 'maxSize'
Maximum total uncompressed size in bytes accepted during extraction (decompression-bomb guard).
METADATA  : string = 'metadata'
Additional metadata to include in `.metadata.json`
OVERWRITE  : string = 'overwrite'
Whether an existing target file may be overwritten.

Constants

Whether to create a symbolic link whose target leaves the extraction directory.

public string ALLOW_UNSAFE_LINKS = 'allowUnsafeLinks'

unzip() refuses, by default, to recreate a link whose target is absolute or climbs out of the destination: a link is the one entry whose content is itself a path, and creating one hands every entry written after it a way out. Set this to true only for an archive you answer for — your own backup, typically, whose links were absolute on the disk it was taken from. Default: false.

DRY_RUN

Return the list of entries instead of extracting them.

public string DRY_RUN = 'dryRun'

EXCLUDE

List of glob patterns or file names to exclude.

public string EXCLUDE = 'exclude'

FILTER

Filter the files or directories to archive with a function (string $filepath): bool

public string FILTER = 'filter'

KEEP_PERMISSIONS

Keep the Unix permissions of the files/directories.

public string KEEP_PERMISSIONS = 'keepPermissions'

MAX_ENTRIES

Maximum number of entries allowed in the archive (decompression-bomb guard).

public string MAX_ENTRIES = 'maxEntries'

When set to a positive integer, unzip() rejects archives that declare more entries than this limit, before extracting anything. Default: null — no limit.

MAX_SIZE

Maximum total uncompressed size in bytes accepted during extraction (decompression-bomb guard).

public string MAX_SIZE = 'maxSize'

When set to a positive integer, unzip() pre-scans the archive and aborts if the sum of the entries' uncompressed sizes exceeds this limit, before any file is written to disk. Default: null — no limit.

METADATA

Additional metadata to include in `.metadata.json`

public string METADATA = 'metadata'

OVERWRITE

Whether an existing target file may be overwritten.

public string OVERWRITE = 'overwrite'
On this page

Search results