bitandblack / unzip
Unpacks ZIP content on the fly, without writing to the file system. Handles files, strings and ressources.
Requires
- php: >=7.4
- ext-zip: *
- nelexa/zip: ^4.0
- symfony/polyfill-php80: ^1.22
Requires (Dev)
- bitandblack/helpers: ^1.6
- maennchen/zipstream-php: ^2.1
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-10-23 18:31:54 UTC
README
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
.