nguyenanhung/zip-helper

PHP Zip Helper - Basic, Simple and Lightweight

v2.0.0 2021-09-23 21:41 UTC

This package is auto-updated.

Last update: 2024-05-24 03:16:53 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version 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

Name Email Skype Facebook
Hung Nguyen dev@nguyenanhung.com nguyenanhung5891 @nguyenanhung

From Vietnam with Love <3