sergiodanilojr / zipper
Zipper 是一种简便创建 Zip 文件的辅助工具,具有下载、插入文件、提取和创建多文件 Zip 的功能!
1.0.0
2020-02-22 01:47 UTC
Requires
- php: ^7.1
- ext-zip: *
This package is auto-updated.
Last update: 2024-09-24 05:51:10 UTC
README
Zipper 是一种简便创建 Zip 文件的辅助工具,具有下载、插入文件、提取和创建多文件 Zip 的功能!
Zipper 是一种简便创建 Zip 文件的方式,包括下载、文件插入、提取和创建多文件 Zip 的功能!
您可以点击此处了解更多信息 点击这里。
亮点
- 简单安装(安装简单)
- 您可以提取 Zip 文件
- 您可以创建包含您想要的任意数量的文件的 Zip 文件
- 存在一个层来显示错误信息(如果出现错误,将显示错误信息)
- 使用 Zipper,只需一行代码就可以轻松强制下载任何文件
- 通过编写更少的代码来简化处理 Zip 文件的方式
- Composer 就绪且符合 PSR-2 规范
安装
Zipper 可通过 Composer 获取
"sergiodanilojr/zipper": "^1.0"
或运行
composer require sergiodanilojr/zipper
文档
有关使用方法的详细信息,请参阅 zipper 目录中的示例文件夹。其中包含了每个类的使用示例。它的工作方式如下
有关如何使用的更多详细信息,请参阅 zipper 目录中的示例文件夹。其中包含了每个类的使用示例。它的工作方式如下
单个文件的 Zipper
<?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
<?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
<?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
<?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 可设置默认路径以保存您构建的文件
<?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 关于错误的对话框
<?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();
其他
这里可以写关于其他说明...
- 当您设置一个不存在的文件夹时,Zipper 组件会为您轻松创建该文件夹!
贡献
请参阅 CONTRIBUTING 以获取详细信息。
支持
安全:如果您发现任何安全相关的问题,请通过电子邮件 sergiodanilojr@hotmail.com 而不是使用问题跟踪器。
如果您发现任何安全相关的问题,请通过电子邮件 sergiodanilojr@hotmail.com 而不是使用问题跟踪器。
开发者打算继续改进此组件!
谢谢
致谢
- Sérgio Danilo Jr.(开发者)
- 所有贡献者
许可证
MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件。