nguyenanhung/zip-helper

PHP Zip Helper - Basic, Simple and Lightweight

v2.0.1 2024-09-21 20:13 UTC

This package is auto-updated.

Last update: 2024-09-21 20:13:55 UTC


README

Latest Stable Version Total Downloads Daily Downloads Monthly Downloads License PHP Version Require

Zip Helper

PHP Zip Helper - Basic, Simple and Lightweight

Version

  • V1.x support all PHP version >=5.6
  • V2.x support all PHP version >=7.0

How to use

Setup helper

Install helper with Composer

composer require nguyenanhung/zip-helper

Code

You can write your app, and see example code same bellow

<?php

use nguyenanhung\Libraries\Zip\Zip;

require_once __DIR__ . '/vendor/autoload.php';

$fileTest = __DIR__ . '/tmp/test-file.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'));

Contact & Support

If any question & request, please contact following information

From Vietnam with Love <3