Skip to content

Cosmin-Ciolacu/zipper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zipper

A simple tool to zip and unzip files. It is a wrapper around the ZipArchive class in PHP.

Requirements

  • PHP 7.4 or higher
  • PHP Zip extension

Installation

composer require cosmin-ciolacu/zipper

Usage

use CosminCiolacu\Zipper\Zipper;

// create zip with files
$zipPath = 'path/to/zip.zip';
$files = ['path/to/file1.txt', 'path/to/file2.txt'];

Zipper::createZip($zipPath, $files);

// unzip
$unzipPath = 'path/to/unzip';
Zipper::unzip($zipPath, $unzipPath);

if the zip path is not found, it will throw FailedToOpenZipFileException.

use CosminCiolacu\Zipper\Exceptions\FailedToOpenZipFileException;

try {
    Zipper::unzip('path/to/zip.zip', 'path/to/unzip');
} catch (FailedToOpenZipFileException $e) {
    echo $e->getMessage();
}

License

The MIT License (MIT). Please see License File for more information.

Testing

./vendor/bin/pest

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages