ffogarasi/s3-bucket-stream-zip-php
最新稳定版本:4.0.1
Composer 安装命令:
composer require ffogarasi/s3-bucket-stream-zip-php
包简介
PHP library to efficiently stream contents from an AWS S3 bucket or folder as a zip file
README 文档
README
Forked from Michaeltlee/s3-bucket-stream-zip-php
Overview
This library lets you efficiently stream the contents of an S3 bucket/folder as a zip file to the client.
Uses v3 of AWS SDK to stream files directly from S3.
Installation
Installation is done via composer by adding the a dependency on .
composer require ffogarasi/s3-bucket-stream-zip-php
Usage
// taken from examples/simple.php // since large buckets may take lots of time we remove any time limits set_time_limit(0); require sprintf('%s/../vendor/autoload.php', __DIR__); use Aws\S3\Exception\S3Exception; use MTL\S3BucketStreamZip\Exception\InvalidParameterException; use MTL\S3BucketStreamZip\S3BucketStreamZip; $auth = [ 'key' => '*****', 'secret' => '*****', 'region' => 'us-east-1', // optional. defaults to us-east-1 'version' => 'latest' // optional. defaults to latest ]; $stream = new S3BucketStreamZip($auth); try { $stream->bucket('testbucket') ->prefix('testfolder') // prefix method adds a trailing '/' ->send('name-of-zipfile-to-send.zip'); } catch (InvalidParameterException $e) { // handle the exception echo $e->getMessage(); } catch (S3Exception $e) { // handle the exception echo $e->getMessage(); }
$stream->bucket('another-test-bucket') ->prefix('test/') ->addParams([ 'MaxKeys' => 1, // array of other parameters ]) ->send('zipfile-to-send.zip');
// if prefix is not supplied, entire bucket contents are streamed $stream->bucket('another-test-bucket') ->send('zipfile-to-send.zip');
Laravel 5.4
pa make:provider AWSZipStreamServiceProviderand copy the contentsexamples/AwsZipStreamServiceProvider.php.- Make sure your config values are all set.
- Register the provider in
config/app.php.
OR in config/app.php
'providers' => [ ... MTL\S3BucketStreamZip\AWSZipStreamServiceProvider::class, ... ]
in config/services.php, set:
's3' => [ 'key' => '', 'secret' => '', 'region' => '', 'version' => '', ];
Authors
- Jaisen Mathai jaisen@jmathai.com - http://jaisenmathai.com
Dependencies
- Paul Duncan pabs@pablotron.org - http://pablotron.org/
- Jonatan Männchen jonatan@maennchen.ch - http://commanders.ch
- Jesse G. Donat donatj@gmail.com - https://donatstudios.com
统计信息
- 总下载量: 3.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-25