Zippy API
Class

Alchemy\Zippy\Adapter\ZipExtensionAdapter

class ZipExtensionAdapter extends AbstractAdapter

ZipExtensionAdapter allows you to create and extract files from archives using PHP Zip extension

Methods

__construct(ResourceManager $manager)

ArchiveInterface open(String $path)

from AbstractAdapter
Boolean isSupported()

Array listMembers(ResourceInterface $resource)

static String getName()

SplFileInfo extract(ResourceInterface $resource, String|null $to = null)

SplFileInfo extractMembers(ResourceInterface $resource, Array $members, String|null $to = null)

Array remove(ResourceInterface $resource, String|Array|Traversable $files)

Array add(ResourceInterface $resource, String|Array|Traversable $files, Boolean $recursive = true)

ArchiveInterface create(String $path, String|Array|Traversable|null $files = null, Boolean $recursive = true)

static AbstractAdapter newInstance()

Returns a new instance of the invoked adapter

checkReadability(ZipArchive $zip, $file)

addFileToZip(ZipArchive $zip, $file)

addEmptyDir(ZipArchive $zip, $dir)

Details

at line 44
public __construct(ResourceManager $manager)

Parameters

ResourceManager $manager

in AbstractAdapter at line 31
public ArchiveInterface open(String $path)

Parameters

String $path The path to the archive

Return Value

ArchiveInterface

at line 56
public Boolean isSupported()

Return Value

Boolean

at line 64
public Array listMembers(ResourceInterface $resource)

Parameters

ResourceInterface $resource The path to the archive

Return Value

Array

at line 85
static public String getName()

Return Value

String

at line 93
public SplFileInfo extract(ResourceInterface $resource, String|null $to = null)

Parameters

ResourceInterface $resource The path to the archive
String|null $to The path where to extract the archive

Return Value

SplFileInfo The extracted archive

at line 101
public SplFileInfo extractMembers(ResourceInterface $resource, Array $members, String|null $to = null)

Parameters

ResourceInterface $resource The path to the archive
Array $members An array of members
String|null $to The path where to extract the members

Return Value

SplFileInfo The extracted archive

at line 149
public Array remove(ResourceInterface $resource, String|Array|Traversable $files)

Parameters

ResourceInterface $resource The path to the archive
String|Array|Traversable $files A filename, an array of files, or a \Traversable instance

Return Value

Array

at line 180
public Array add(ResourceInterface $resource, String|Array|Traversable $files, Boolean $recursive = true)

Parameters

ResourceInterface $resource The path to the archive
String|Array|Traversable $files An array of paths to add, relative to cwd
Boolean $recursive Whether or not to recurse in the provided directories

Return Value

Array

at line 195
public ArchiveInterface create(String $path, String|Array|Traversable|null $files = null, Boolean $recursive = true)

Parameters

String $path The path to the archive
String|Array|Traversable|null $files A filename, an array of files, or a \Traversable instance
Boolean $recursive Whether to recurse or not in the provided directories

Return Value

ArchiveInterface

at line 216
static public AbstractAdapter newInstance()

Returns a new instance of the invoked adapter

Return Value

AbstractAdapter

Exceptions

RuntimeException In case object could not be instanciated

at line 302
public checkReadability(ZipArchive $zip, $file)

Parameters

ZipArchive $zip
$file

at line 315
public addFileToZip(ZipArchive $zip, $file)

Parameters

ZipArchive $zip
$file

at line 328
public addEmptyDir(ZipArchive $zip, $dir)

Parameters

ZipArchive $zip
$dir