ediazaro/s3-objects-stream-zip-php
最新稳定版本:v5.0.0
Composer 安装命令:
composer require ediazaro/s3-objects-stream-zip-php
包简介
S3ObjectsStreamZip is a PHP library to stream objects from AWS S3 as a zip file.
关键字:
README 文档
README
Overview
S3ObjectsStreamZip is a PHP library to stream objects from AWS S3 as a zip file.
Uses AWS SDK Version 3 to stream objects directly from S3.
Install
composer require wgenial/s3-objects-stream-zip-php
Usage
See example folder.
<?php include __DIR__.'/../vendor/autoload.php'; use Aws\S3\Exception\S3Exception; use WGenial\S3ObjectsStreamZip\S3ObjectsStreamZip; use WGenial\S3ObjectsStreamZip\Exception\InvalidParamsException; try { // http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/credentials.html#hardcoded-credentials $zipStream = new S3ObjectsStreamZip(array( 'version' => 'latest', // https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_configuration.html#version 'region' => 'your-aws-bucket-region', // https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_configuration.html#region 'credentials' => array( 'key' => 'your-aws-key', 'secret' => 'your-aws-secret' ), // 'endpoint' => '', // https://docs.aws.amazon.com/general/latest/gr/s3.html // 'bucket_endpoint' => '', // https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.S3.S3Client.html#___construct )); $bucket = 'your-s3-bucket'; // required $objects = array( array( 'path' => 'file-text.txt' // required ), array( 'name' => 'file-pdf.pdf', // not required 'path' => 'file-pdf.pdf' // required ), array( 'path' => 'logs/file-log.txt' // required ), array( 'name' => 'image.png', // you can rename an object to zip, not required 'path' => 'file-image.png' // required ) ); $zipname = 'compress.zip'; // required $checkObjectExist = false; // no required | default = false $zipStream->zipObjects($bucket, $objects, $zipname, $checkObjectExist); } catch (InvalidParamsException $e) { echo $e->getMessage(); } catch (S3Exception $e) { echo $e->getMessage(); }
Dependencies
aws/aws-sdk-phpmaennchen/zipstream-phpguzzlehttp/guzzle
Author
Contributors
统计信息
- 总下载量: 44
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-12