Unpacks ZIP content on the fly, without writing to the file system. Handles files, strings and ressources.

0.1.0 2021-03-22 11:44 UTC

This package is auto-updated.

Last update: 2024-04-23 17:17:26 UTC


README

PHP from Packagist Latest Stable Version Total Downloads License

Bit&Black Unzip

Unpacks ZIP content on the fly, without writing to the file system. Handles files, strings and ressources.

Installation

This library is made for the use with Composer. Add it to your project by running $ composer require bitandblack/unzip.

Usage

Using the auto ZIP handler

Maybe the easiest way is to use the AutoZIPHandler. It detects the kind of ZIP content by its own and returns a FileType, StringType or StreamType object.

<?php 

use BitAndBlack\Unzip\AutoZIPHandler;
 
$zipContent = AutoZIPHandler::create($whateverZIPContent);

Call getContents() to see what is inside the ZIP.

The ZIP content can be extracted to the file system by calling extractTo().

Manual set up

You can set up the file type by your own too. For example:

<?php 

use BitAndBlack\Unzip\Type\FileType;
 
$fileType = new FileType('/path/to/file.zip');

$contents = $fileType->getContents();

Help

If you have questions feel free to contact us under hello@bitandblack.com.