PHP code example of nguyenanhung / zip-helper
1. Go to this page and download the library: Download nguyenanhung/zip-helper library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nguyenanhung / zip-helper example snippets
use nguyenanhung\Libraries\Zip\Zip;
;
$zip = new Zip();
$zip->setFilename($fileTest);
$zip->setDataList(
array(
__DIR__ . '/docs', // Your Path
__DIR__ . '/docs/README.md' // Your file
)
);
// Compress with ZIP
$result = $zip->zip(); // Add all data in $dataList to $filename
d($result);
d(directory_map(__DIR__ . '/tmp'));
// Extract Zip file
$zip->setExtractFolder(__DIR__ . '/tmp');
$extract = $zip->unzip();
d($extract);
d(directory_map(__DIR__ . '/tmp'));