sergiodanilojr / zipper
Zipper is a facilitator for creating Zip Files in an uncomplicated way, with features of Download, Insert Files, Extraction and Creation of Zip with multiple in one!
Requires
- php: ^7.1
- ext-zip: *
This package is auto-updated.
Last update: 2024-12-24 06:32:47 UTC
README
Zipper is a facilitator for creating Zip Files in an uncomplicated way, with features of Download, Insert Files, Extraction and Creation of Zip with multiple in one!
Zipper é um facilitador para criação de Arquivos Zip de maneira descomplicada, contando com recursos de Download, inserção de Arquivos, Extração e Criação de Zipagem com múltiplos em um só!
Você pode saber mais clicando aqui.
Highlights
- Simple installation (Instalação simples)
- You can Extract Zip Files (Você pode extrair arquivos zip)
- You can Create a Zip File with how many you want (É possível criar Arquivos Zip com quantos arquivos desejar)
- There is a layer to show error messages (Possui mensagens, caso um erro impeça a execução desejada)
- With Zipper is so easy force a download of any file with only one line of code (Com o Zipper é uito fácil forçar o download de qualquer arquivo com somente uma linha de código)
- Facilitates how to handle zip files by writing less code (Facilita a manipulação de Arquivos Zip escrevendo menos código)
- Composer ready and PSR-2 compliant (Pronto para o composer e compatível com PSR-2)
Installation
Zipper is available via Composer:
"sergiodanilojr/zipper": "^1.0"
or run
composer require sergiodanilojr/zipper
Documentation
For details on how to use, see a sample folder in the zipper directory. In it you will have an example of use for each class. It works like this:
Para mais detalhes sobre como usar, veja uma pasta de exemplo no diretório do zipper. Nela terá um exemplo de uso para cada classe. Ele funciona assim:
Zipper for a single File
<?php require __DIR__ . "/vendor/autoload.php"; use SergioDaniloJr\Zipper\Zipper; $zipper = new Zipper(); $fileExample = __DIR__."/assets/files/example-file.txt"; $single = $zipper->zipFile($fileExample); //It'll bring the way of the zip File echo $single;
Zipper for Several Files
<?php require __DIR__ . "/vendor/autoload.php"; use SergioDaniloJr\Zipper\Zipper; $zipper = new Zipper(); $fileOne = __DIR__."/assets/files/example-file.txt"; $fileTwo = __DIR__."/assets/files/example-file-two.txt"; $files = [ $fileOne, $fileTwo ]; //Here I'll set a new folder that not exists yet. $path = __DIR__."/assets/files/ZipperFiles"; $several = $zipper->zipFiles($files, "MadeWithZipper", $path); echo $several;
Zipper for Extract File
<?php require __DIR__ . "/vendor/autoload.php"; use SergioDaniloJr\Zipper\Zipper; $zipper = new Zipper(); $fileToExtract = __DIR__ . "/assets/files/MadeWithZipper.zip"; //Here I'll set a new folder that not exists yet. But You can set a existent folder. $destiny = __DIR__ . "/assets/files/Storage"; $extracted = $zipper->extract($fileToExtract,$destiny); echo $extracted;
Zipper for Download a File
<?php require __DIR__ . "/vendor/autoload.php"; use SergioDaniloJr\Zipper\Zipper; $zipper = new Zipper(); $fileExample = __DIR__ . "/assets/files/example-file.txt"; //This method don't return, obvly, a way! $zipper->download($fileExample);
Zipper possibility set a default path to save a File in your contruction
<?php require __DIR__ . "/vendor/autoload.php"; use SergioDaniloJr\Zipper\Zipper; $path = __DIR__."/ZipperFolder"; // Like that you can set a default folder for save the zip files generated with the methods above. $zipper = new Zipper($path); // NOTE: If you set a folder that not exist, Zipper understanding this and will create a new folder like you want! Zipper's Wonderful, no?!
Zipper dialog about errors
<?php require __DIR__ . "/vendor/autoload.php"; use SergioDaniloJr\Zipper\Zipper; $zipper = new Zipper(); //When there'is an error, you can calll the message method for show the error message, it comes like a 'string' type $zipper->message();
Others
Here is possible write about others explanations...
- When you set a folder that not exists, the Zipper Component create the folder for you easyly!
Contributing
Please see CONTRIBUTING for details.
Support
Security: If you discover any security related issues, please email sergiodanilojr@hotmail.com instead of using the issue tracker.
Se você descobrir algum problema relacionado à segurança, envie um e-mail para sergiodanilojr@hotmail.com em vez de usar o rastreador de problemas.
The Develoer pretends continue improving this component!
Thank you
Credits
- Sérgio Danilo Jr. (Developer)
- All Contributors
License
The MIT License (MIT). Please see License File for more information.