vsolution-dev/laravel-zipper
最新稳定版本:0.0.2
Composer 安装命令:
composer require vsolution-dev/laravel-zipper
包简介
README 文档
README
Laravel Zipper Library
This library provides a convenient way to zip files in Laravel applications.
Installation
You can install this library using Composer. Run the following command:
composer require vsolution-dev/laravel-zipper
After the installation, you need to add the service provider and facade to your app.php configuration file.
Add the following line to the providers array:
VSolutionDev\LaravelZipper\ServiceProvider::class,
And add the following line to the aliases array:
'Zipper' => VSolutionDev\LaravelZipper\Facades\Zipper::class,
Requirements
This library requires PHP 7.4 or above. Make sure your server meets this requirement before installing.
Usage
To use this library, you can follow the example below:
$files = collect(); Qrcode::query() ->lazyById(1000) ->each(function ($qrcode) use ($files) { $files->add([ 'url' => $qrcode->url, // http://www.example.com/qrcode.png 'name' => "{$qrcode->id}.png" ]); }); Zipper::queue($files, 'qrcodes.zip', 's3') ->allOnQueue('longtime') ->chain([ (new SendMail())->attachFromStorageDisk('qrcodes.zip', 's3') ]);
In this example, after queuing the files for zipping using Zipper::queue(), we chain it with the SendMail job. The SendMail job is responsible for sending an email with the zip file attached. It uses the attachFromStorageDisk() method to attach the zip file from the specified storage disk ('s3' in this case).
Make sure you have the SendMail job defined with the appropriate logic to send the email. You may need to customize it according to your email sending implementation.
统计信息
- 总下载量: 1.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-28