wgenial/s3-bucket-stream-zip-php

PHP 库,用于高效地将 AWS S3 存储桶或文件夹的内容作为 zip 文件流式传输

1.0.2 2016-11-02 11:09 UTC

This package is auto-updated.

Last update: 2024-09-09 05:35:43 UTC


README

Build Status Code Coverage

概述

此库允许您将 S3 存储桶/文件夹的内容高效地作为 zip 文件流式传输到客户端。

安装

通过 composer 安装,添加对 jmathai/s3-bucket-stream-zip-php 的依赖。

composer require jmathai/s3-bucket-stream-zip-php
composer install

使用方法

// 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 JMathai\S3BucketStreamZip\S3BucketStreamZip;
use JMathai\S3BucketStreamZip\Exception\InvalidParameterException;

$stream = new S3BucketStreamZip(
            // $auth
            array(
              'key'     => '*********',   // required
              'secret'  => '*********'    // required
            ),
            // $params
            array(
              'Bucket'  => 'bucketname',  // required
              'Prefix'  => 'subfolder/'   // optional (path to folder to stream)
            )
          );

$stream->send('name-of-zipfile-to-send.zip');

$stream->sendFiles('name-of-zipfile-to-send-2.zip', array(
  'files' => array(
    array(
      'key' => 'filename1.jpg',
    },
    array(
      'key' => 'filename2.jpg',
      'name' => 'image2.jpg'
    },
  )
);

作者

依赖