1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-03-19 22:19:40 +01:00
php-zip/README.md

545 lines
17 KiB
Markdown
Raw Normal View History

2017-03-13 08:33:45 +03:00
`PhpZip`
====================
`PhpZip` - php library for manipulating zip archives.
2016-09-08 19:18:53 +03:00
2017-03-13 08:33:45 +03:00
[![Latest Stable Version](https://poser.pugx.org/nelexa/zip/v/stable)](https://packagist.org/packages/nelexa/zip)
[![Total Downloads](https://poser.pugx.org/nelexa/zip/downloads)](https://packagist.org/packages/nelexa/zip)
2017-03-13 19:59:30 +03:00
[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%205.5-8892BF.svg)](https://php.net/)
[![Test Coverage](https://codeclimate.com/github/Ne-Lexa/php-zip/badges/coverage.svg)](https://codeclimate.com/github/Ne-Lexa/php-zip/coverage)
2017-03-13 08:33:45 +03:00
[![License](https://poser.pugx.org/nelexa/zip/license)](https://packagist.org/packages/nelexa/zip)
2017-03-13 19:59:30 +03:00
Table of contents
-----------------
- [Features](#Features)
- [Requirements](#Requirements)
- [Installation](#Installation)
- [Examples](#Examples)
- [Documentation](#Documentation)
+ [Open Zip Archive](#Documentation-Open-Zip-Archive)
+ [Get Zip Entries](#Documentation-Open-Zip-Entries)
+ [Add Zip Entries](#Documentation-Add-Zip-Entries)
### <a name="Features"></a> Features
- Opening and unzipping zip files.
- Create zip files.
- Update zip files.
- Pure php (not require extension `php-zip` and class `\ZipArchive`).
- Output the modified archive as a string or output to the browser without saving the result to disk.
- Support archive comment and entries comments.
- Get info of zip entries.
- Support zip password for PHP < 5.6.0 (`\ZipArchive` required this version), include update and remove password.
- Support encryption method `Traditional PKWARE Encryption (ZipCrypto)` and `WinZIP AES Encryption`.
- Support `ZIP64` (size > 4 GiB or files > 65535 in a .ZIP archive).
- Support archive alignment functional [`zipalign`](https://developer.android.com/studio/command-line/zipalign.html).
2017-03-13 19:59:30 +03:00
### <a name="Requirements"></a> Requirements
2017-03-13 09:13:19 +03:00
- `PHP` >= 5.5 (64 bit)
- Optional php-extension `bzip2` for BZIP2 compression.
- Optional php-extension `openssl` or `mcrypt` for `WinZip Aes Encryption` support.
2017-03-13 19:59:30 +03:00
### <a name="Installation"></a> Installation
`composer require nelexa/zip:^3.0`
2017-03-13 19:59:30 +03:00
### <a name="Examples"></a> Examples
```php
2017-03-13 19:59:30 +03:00
// create new archive
$zipFile = new \PhpZip\ZipFile();
2017-03-13 19:59:30 +03:00
$zipFile
->addFromString("zip/entry/filename", "Is file content")
->addFile("/path/to/file", "data/tofile")
->addDir(__DIR__, "to/path/")
->saveAsFile($outputFilename)
->close();
// open archive, extract, add files, set password and output to browser.
2017-03-13 19:59:30 +03:00
$zipFile
->openFile($outputFilename)
->extractTo($outputDirExtract)
->deleteFromRegex('~^\.~') // delete all hidden (Unix) files
->addFromString('dir/file.txt', 'Test file')
->withNewPassword('password')
->outputAsAttachment('library.jar');
```
Other examples can be found in the `tests/` folder
2017-03-13 19:59:30 +03:00
### <a name="Documentation"></a> Documentation
###### <a name="Documentation-Open-Zip-Archive"></a> Open Zip Archive
Open zip archive from file.
2016-09-08 19:18:53 +03:00
```php
$zipFile = new \PhpZip\ZipFile();
$zipFile->openFile($filename);
2016-09-08 19:18:53 +03:00
```
Open zip archive from data string.
2016-09-08 19:18:53 +03:00
```php
$zipFile = new \PhpZip\ZipFile();
2017-03-13 19:59:30 +03:00
$zipFile->openFromString($stringContents);
2016-09-08 19:18:53 +03:00
```
Open zip archive from stream resource.
2016-09-08 19:18:53 +03:00
```php
$stream = fopen($filename, 'rb');
2017-03-13 19:59:30 +03:00
$zipFile = new \PhpZip\ZipFile();
$zipFile->openFromStream($stream);
###### <a name="Documentation-Open-Zip-Entries"></a> Get Zip Entries
2016-09-08 19:18:53 +03:00
```
Get num entries.
2016-09-08 19:18:53 +03:00
```php
$count = count($zipFile);
2017-03-13 19:59:30 +03:00
// or
$count = $zipFile->count();
2016-09-08 19:18:53 +03:00
```
Get list files.
2016-09-08 19:18:53 +03:00
```php
$listFiles = $zipFile->getListFiles();
2017-03-13 19:59:30 +03:00
// Example result:
//
// $listFiles = [
// 'info.txt',
// 'path/to/file.jpg',
// 'another path/'
// ];
```
Get entry contents.
```php
// $entryName = 'path/to/example-entry-name.txt';
$contents = $zipFile[$entryName];
```
Checks whether a entry exists.
```php
// $entryName = 'path/to/example-entry-name.txt';
$hasEntry = isset($zipFile[$entryName]);
```
Check whether the directory entry.
```php
// $entryName = 'path/to/';
$isDirectory = $zipFile->isDirectory($entryName);
```
Extract all files to directory.
```php
$zipFile->extractTo($directory);
2016-09-08 19:18:53 +03:00
```
2017-03-13 19:59:30 +03:00
Extract some files to directory.
```php
$extractOnlyFiles = [
"filename1",
"filename2",
"dir/dir/dir/"
];
$zipFile->extractTo($directory, $extractOnlyFiles);
```
Iterate zip entries.
2016-09-08 19:18:53 +03:00
```php
foreach($zipFile as $entryName => $dataContent){
echo "Entry: $entryName" . PHP_EOL;
echo "Data: $dataContent" . PHP_EOL;
echo "-----------------------------" . PHP_EOL;
}
2016-09-08 19:18:53 +03:00
```
2017-03-13 19:59:30 +03:00
or
2016-09-08 19:18:53 +03:00
```php
$iterator = new \ArrayIterator($zipFile);
while ($iterator->valid())
{
$entryName = $iterator->key();
$dataContent = $iterator->current();
echo "Entry: $entryName" . PHP_EOL;
echo "Data: $dataContent" . PHP_EOL;
echo "-----------------------------" . PHP_EOL;
$iterator->next();
}
2016-09-08 19:18:53 +03:00
```
Get comment archive.
```php
2017-03-13 19:59:30 +03:00
$commentArchive = $zipFile->getArchiveComment();
```
Get comment zip entry.
```php
$commentEntry = $zipFile->getEntryComment($entryName);
```
2017-03-13 19:59:30 +03:00
Set password for read encrypted entries.
```php
$zipFile->withReadPassword($password);
```
Get entry info.
2016-09-08 19:18:53 +03:00
```php
$zipInfo = $zipFile->getEntryInfo('file.txt');
2017-03-13 19:59:30 +03:00
echo $zipInfo . PHP_EOL;
2017-03-13 19:59:30 +03:00
// Output:
// ZipInfo {Path="file.txt", Size=9.77KB, Compressed size=2.04KB, Modified time=2016-09-24T19:25:10+03:00, Crc=0x4b5ab5c7, Method="Deflate", Attributes="-rw-r--r--", Platform="UNIX", Version=20}
2017-03-13 19:59:30 +03:00
print_r($zipInfo);
2017-03-13 19:59:30 +03:00
// Output:
// PhpZip\Model\ZipInfo Object
// (
// [path:PhpZip\Model\ZipInfo:private] => file.txt
// [folder:PhpZip\Model\ZipInfo:private] =>
// [size:PhpZip\Model\ZipInfo:private] => 10000
// [compressedSize:PhpZip\Model\ZipInfo:private] => 2086
// [mtime:PhpZip\Model\ZipInfo:private] => 1474734310
// [ctime:PhpZip\Model\ZipInfo:private] =>
// [atime:PhpZip\Model\ZipInfo:private] =>
// [encrypted:PhpZip\Model\ZipInfo:private] =>
// [comment:PhpZip\Model\ZipInfo:private] =>
// [crc:PhpZip\Model\ZipInfo:private] => 1264235975
// [method:PhpZip\Model\ZipInfo:private] => Deflate
// [platform:PhpZip\Model\ZipInfo:private] => UNIX
// [version:PhpZip\Model\ZipInfo:private] => 20
// [attributes:PhpZip\Model\ZipInfo:private] => -rw-r--r--
// )
2016-09-08 19:18:53 +03:00
```
Get info for all entries.
2016-09-08 19:18:53 +03:00
```php
$zipAllInfo = $zipFile->getAllInfo();
2017-03-13 19:59:30 +03:00
print_r($zipAllInfo);
2017-03-13 19:59:30 +03:00
//Array
//(
// [file.txt] => PhpZip\Model\ZipInfo Object
// (
// ...
// )
//
// [file2.txt] => PhpZip\Model\ZipInfo Object
// (
// ...
// )
//
// ...
//)
2017-03-13 19:59:30 +03:00
###### <a name="Documentation-Add-Zip-Entries"></a> Add Zip Entries
2016-09-08 19:18:53 +03:00
```
2017-03-13 19:59:30 +03:00
Adding a file to the zip-archive.
2016-09-08 19:18:53 +03:00
```php
2017-03-13 19:59:30 +03:00
// entry name is file basename.
$zipFile->addFile($filename);
// or
2017-03-13 19:59:30 +03:00
$zipFile->addFile($filename, null);
2017-03-13 19:59:30 +03:00
// with entry name
$zipFile->addFile($filename, $entryName);
// or
2017-03-13 19:59:30 +03:00
$zipFile[$entryName] = new \SplFileInfo($filename);
// with compression method
$zipOFile->addFile($filename, $entryName, ZipFile::METHOD_DEFLATED); // Deflate compression
$zipFile->addFile($filename, $entryName, ZipFile::METHOD_STORED); // No compression
$zipFile->addFile($filename, null, ZipFile::METHOD_BZIP2); // BZIP2 compression
```
Add entry from string data.
```php
2017-03-13 19:59:30 +03:00
$zipFile[$entryName] = $data;
// or
$zipFile->addFromString($entryName, $data);
// with compression method
$zipFile->addFromString($entryName, $data, ZipFile::METHOD_DEFLATED); // Deflate compression
$zipFile->addFromString($entryName, $data, ZipFile::METHOD_STORED); // No compression
$zipFile->addFromString($entryName, $data, ZipFile::METHOD_BZIP2); // BZIP2 compression
```
Add entry from stream.
```php
2017-03-13 19:59:30 +03:00
// $stream = fopen(...);
$zipFile->addFromStream($stream, $entryName);
// with compression method
$zipFile->addFromStream($stream, $entryName, ZipFile::METHOD_DEFLATED); Deflate compression
$zipFile->addFromStream($stream, $entryName, ZipFile::METHOD_STORED); // No compression
$zipFile->addFromStream($stream, $entryName, ZipFile::METHOD_BZIP2); // BZIP2 compression
```
Add empty dir
2016-09-08 19:18:53 +03:00
```php
2017-03-13 19:59:30 +03:00
$zipFile->addEmptyDir($dirName);
// or
2017-03-13 19:59:30 +03:00
$zipFile[$dirName] = null;
2016-09-08 19:18:53 +03:00
```
2017-03-13 19:59:30 +03:00
Add all entries form string contents.
2016-09-08 19:18:53 +03:00
```php
2017-03-13 19:59:30 +03:00
$mapData = [
'file.txt' => 'file contents',
'path/to/file.txt' => 'another file contents',
'empty dir/' => null,
];
$zipFile->addAll($mapData);
2016-09-08 19:18:53 +03:00
```
2017-03-13 19:59:30 +03:00
Add a directory **not recursively** to the archive.
2016-09-08 19:18:53 +03:00
```php
2017-03-13 19:59:30 +03:00
$zipFile->addDir($dirName);
// with entry path
$localPath = "to/path/";
$zipFile->addDir($dirName, $localPath);
// with compression method for all files
$zipFile->addDir($dirName, $localPath, ZipFile::METHOD_DEFLATED); Deflate compression
$zipFile->addDir($dirName, $localPath, ZipFile::METHOD_STORED); // No compression
$zipFile->addDir($dirName, $localPath, ZipFile::METHOD_BZIP2); // BZIP2 compression
2016-09-08 19:18:53 +03:00
```
Add a directory to the archive with ignoring files.
2016-09-08 19:18:53 +03:00
```php
$ignoreFiles = ["file_ignore.txt", "dir_ignore/sub dir ignore/"];
$zipOutputFile->addDir($dirName, $boolResursive, $moveToPath, $ignoreFiles);
2016-09-08 19:18:53 +03:00
```
Add a directory and set compression method.
2016-09-08 19:18:53 +03:00
```php
2017-03-13 19:59:30 +03:00
$compressionMethod = ZipFile::METHOD_DEFLATED;
$zipOutputFile->addDir($dirName, $boolRecursive, $moveToPath, $ignoreFiles, $compressionMethod);
2016-09-08 19:18:53 +03:00
```
Add a files **recursively** from [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) to the archive.
2016-09-08 19:18:53 +03:00
```php
$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern -> add all .jpg, .jpeg, .png and .gif files
$zipOutputFile->addFilesFromGlob($inputDir, $globPattern);
2016-09-08 19:18:53 +03:00
```
Add a files **not recursively** from [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) to the archive.
2016-09-08 19:18:53 +03:00
```php
$recursive = false;
$zipOutputFile->addFilesFromGlob($inputDir, $globPattern, $recursive);
2016-09-08 19:18:53 +03:00
```
Add a files from [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) to the archive by path `$moveToPath`.
2016-09-08 19:18:53 +03:00
```php
$moveToPath = 'dir/dir2/dir3';
$zipOutputFile->addFilesFromGlob($inputDir, $globPattern, $recursive = true, $moveToPath);
2016-09-08 19:18:53 +03:00
```
Add a files from [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) to the archive and set compression method.
2016-09-08 19:18:53 +03:00
```php
2017-03-13 19:59:30 +03:00
$compressionMethod = ZipFile::METHOD_DEFLATED;
$zipOutputFile->addFilesFromGlob($inputDir, $globPattern, $recursive, $moveToPath, $compressionMethod);
2016-09-08 19:18:53 +03:00
```
Add a files **recursively** from [RegEx (Regular Expression) pattern](https://en.wikipedia.org/wiki/Regular_expression) to the archive.
2016-09-08 19:18:53 +03:00
```php
$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern -> add all .jpg, .jpeg, .png and .gif files
$zipOutputFile->addFilesFromRegex($inputDir, $regexPattern);
2016-09-08 19:18:53 +03:00
```
Add a files **not recursively** from [RegEx (Regular Expression) pattern](https://en.wikipedia.org/wiki/Regular_expression) to the archive.
2016-09-08 19:18:53 +03:00
```php
$recursive = false;
$zipOutputFile->addFilesFromRegex($inputDir, $regexPattern, $recursive);
2016-09-08 19:18:53 +03:00
```
Add a files from [RegEx (Regular Expression) pattern](https://en.wikipedia.org/wiki/Regular_expression) to the archive by path `$moveToPath`.
2016-09-08 19:18:53 +03:00
```php
$moveToPath = 'dir/dir2/dir3';
$zipOutputFile->addFilesFromRegex($inputDir, $regexPattern, $recursive = true, $moveToPath);
2016-09-08 19:18:53 +03:00
```
Add a files from [RegEx (Regular Expression) pattern](https://en.wikipedia.org/wiki/Regular_expression) to the archive and set compression method.
2016-09-08 19:18:53 +03:00
```php
2017-03-13 19:59:30 +03:00
$compressionMethod = ZipFile::METHOD_DEFLATED;
$zipOutputFile->addFilesFromRegex($inputDir, $regexPattern, $recursive, $moveToPath, $compressionMethod);
2016-09-08 19:18:53 +03:00
```
Rename entry name.
2016-09-08 19:18:53 +03:00
```php
$zipOutputFile->rename($oldName, $newName);
2016-09-08 19:18:53 +03:00
```
Delete entry by name.
2016-09-08 19:18:53 +03:00
```php
$zipOutputFile->deleteFromName($entryName);
2016-09-08 19:18:53 +03:00
```
Delete entries from [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)).
2016-09-08 19:18:53 +03:00
```php
$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern -> delete all .jpg, .jpeg, .png and .gif files
$zipOutputFile->deleteFromGlob($globPattern);
2016-09-08 19:18:53 +03:00
```
Delete entries from [RegEx (Regular Expression) pattern](https://en.wikipedia.org/wiki/Regular_expression).
2016-09-08 19:18:53 +03:00
```php
$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern -> delete all .jpg, .jpeg, .png and .gif files
$zipOutputFile->deleteFromRegex($regexPattern);
2016-09-08 19:18:53 +03:00
```
Delete all entries.
2016-09-08 19:18:53 +03:00
```php
$zipOutputFile->deleteAll();
2016-09-08 19:18:53 +03:00
```
Get num entries.
2016-09-08 19:18:53 +03:00
```php
$count = $zipOutputFile->count();
// or
$count = count($zipOutputFile);
2016-09-08 19:18:53 +03:00
```
Get list files.
2016-09-08 19:18:53 +03:00
```php
$listFiles = $zipOutputFile->getListFiles();
2016-09-08 19:18:53 +03:00
```
Get the compression level for entries.
2016-09-08 19:18:53 +03:00
```php
$compressionLevel = $zipOutputFile->getLevel();
2016-09-08 19:18:53 +03:00
```
Sets the compression level for entries.
2016-09-08 19:18:53 +03:00
```php
// This property is only used if the effective compression method is DEFLATED or BZIP2.
// Legal values are ZipOutputFile::LEVEL_DEFAULT_COMPRESSION or range from
// ZipOutputFile::LEVEL_BEST_SPEED to ZipOutputFile::LEVEL_BEST_COMPRESSION.
$compressionMethod = ZipOutputFile::LEVEL_BEST_COMPRESSION;
$zipOutputFile->setLevel($compressionLevel);
2016-09-08 19:18:53 +03:00
```
Get comment archive.
2016-09-08 19:18:53 +03:00
```php
$commentArchive = $zipOutputFile->getComment();
2016-09-08 19:18:53 +03:00
```
Set comment archive.
2016-09-08 19:18:53 +03:00
```php
$zipOutputFile->setComment($commentArchive);
2016-09-08 19:18:53 +03:00
```
Get comment zip entry.
2016-09-08 19:18:53 +03:00
```php
$commentEntry = $zipOutputFile->getEntryComment($entryName);
2016-09-08 19:18:53 +03:00
```
Set comment zip entry.
```php
$zipOutputFile->setEntryComment($entryName, $entryComment);
```
Set compression method for zip entry.
```php
2017-03-13 19:59:30 +03:00
$compressionMethod = ZipFile::METHOD_DEFLATED;
$zipOutputMethod->setCompressionMethod($entryName, $compressionMethod);
// Support compression methods:
2017-03-13 19:59:30 +03:00
// ZipFile::METHOD_STORED - no compression
// ZipFile::METHOD_DEFLATED - deflate compression
// ZipFile::METHOD_BZIP2 - bzip2 compression (need bz2 extension)
```
Set a password for all previously added entries.
```php
$zipOutputFile->setPassword($password);
```
Set a password and encryption method for all previously added entries.
```php
2017-03-13 19:59:30 +03:00
$encryptionMethod = ZipFile::ENCRYPTION_METHOD_WINZIP_AES; // default value
$zipOutputFile->setPassword($password, $encryptionMethod);
2016-09-08 19:18:53 +03:00
// Support encryption methods:
2017-03-13 19:59:30 +03:00
// ZipFile::ENCRYPTION_METHOD_TRADITIONAL - Traditional PKWARE Encryption
// ZipFile::ENCRYPTION_METHOD_WINZIP_AES - WinZip AES Encryption
```
Set a password for a concrete entry.
```php
$zipOutputFile->setEntryPassword($entryName, $password);
```
Set a password and encryption method for a concrete entry.
2016-09-08 19:18:53 +03:00
```php
$zipOutputFile->setEntryPassword($entryName, $password, $encryptionMethod);
2016-09-08 19:18:53 +03:00
// Support encryption methods:
2017-03-13 19:59:30 +03:00
// ZipFile::ENCRYPTION_METHOD_TRADITIONAL - Traditional PKWARE Encryption
// ZipFile::ENCRYPTION_METHOD_WINZIP_AES - WinZip AES Encryption (default value)
```
Remove password from all entries.
```php
$zipOutputFile->removePasswordAllEntries();
```
Remove password for concrete zip entry.
```php
$zipOutputFile->removePasswordFromEntry($entryName);
```
Save archive to a file.
```php
$zipOutputFile->saveAsFile($filename);
```
Save archive to a stream.
```php
2016-09-26 18:33:05 +03:00
$handle = fopen($filename, 'w+b');
$autoCloseResource = true;
$zipOutputFile->saveAsStream($handle, $autoCloseResource);
if(!$autoCloseResource){
fclose($handle);
}
```
Returns the zip archive as a string.
```php
$rawZipArchiveBytes = $zipOutputFile->outputAsString();
```
Output .ZIP archive as attachment and terminate.
```php
$zipOutputFile->outputAsAttachment($outputFilename);
// or set mime type
$zipOutputFile->outputAsAttachment($outputFilename = 'output.zip', $mimeType = 'application/zip');
```
Extract all files to directory.
```php
$zipOutputFile->extractTo($directory);
2016-09-08 19:18:53 +03:00
```
Extract some files to directory.
```php
$extractOnlyFiles = ["filename1", "filename2", "dir/dir/dir/"];
$zipOutputFile->extractTo($directory, $extractOnlyFiles);
```
Get entry contents.
```php
$data = $zipOutputFile->getEntryContent($entryName);
```
Foreach zip entries.
```php
foreach($zipOutputFile as $entryName => $dataContent){
echo "Entry: $entryName" . PHP_EOL;
echo "Data: $dataContent" . PHP_EOL;
echo "-----------------------------" . PHP_EOL;
}
```
Iterator zip entries.
```php
$iterator = new \ArrayIterator($zipOutputFile);
while ($iterator->valid())
{
$entryName = $iterator->key();
$dataContent = $iterator->current();
2016-09-08 19:18:53 +03:00
echo "Entry: $entryName" . PHP_EOL;
echo "Data: $dataContent" . PHP_EOL;
echo "-----------------------------" . PHP_EOL;
$iterator->next();
}
```
Set zip alignment (alternate program `zipalign`).
```php
// before save or output
$zipOutputFile->setAlign(4); // alternative cmd: zipalign -f -v 4 filename.zip
```
Close zip archive.
2016-09-08 19:18:53 +03:00
```php
$zipOutputFile->close();
```
Examples
--------
Create, open, extract and update archive.
```php
$outputFilename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'output.zip';
$outputDirExtract = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'extract';
if(!is_dir($outputDirExtract)){
mkdir($outputDirExtract, 0755, true);
}
$zipOutputFile = \PhpZip\ZipOutputFile::create(); // create archive
$zipOutputFile->addDir(__DIR__, true); // add this dir to archive
$zipOutputFile->saveAsFile($outputFilename); // save as file
$zipOutputFile->close(); // close output file, release all streams
$zipFile = \PhpZip\ZipFile::openFromFile($outputFilename); // open zip archive from file
$zipFile->extractTo($outputDirExtract); // extract files to dir
$zipOutputFile = $zipFile->edit(); // create zip output archive for update
$zipOutputFile->deleteFromRegex('~^\.~'); // delete all hidden (Unix) files
$zipOutputFile->addFromString('dir/file.txt', 'Test file'); // add files from string contents
$zipOutputFile->saveAsFile($outputFilename); // update zip file
$zipOutputFile->close(); // close output file, release all streams
$zipFile->close(); // close input file, release all streams
```
Other examples can be found in the `tests/` folder
2016-09-08 19:18:53 +03:00
Running Tests
-------------
```bash
vendor/bin/phpunit -v --tap -c bootstrap.xml
2016-09-08 19:18:53 +03:00
```