GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - wgenial/s3-objects-stream-zip-php: 🗜️ 3ObjectsStreamZip is a PHP library to stream objects from AWS S3 as a zip file.

BranchesTags
Open more actions menu

Latest commit

 

History

62 Commits
62 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
example
example
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
phpunit.xml
phpunit.xml
 
 

Repository files navigation

S3ObjectsStreamZip

Packagist PHP Version Codacy GitHub Workflow Status Travis License

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-php
  • maennchen/zipstream-php
  • guzzlehttp/guzzle

Author

  • @giovanigenerali

Contributors

  • @sjoerdstaal
  • @florianv
  • @marcelod

About

🗜️ 3ObjectsStreamZip is a PHP library to stream objects from AWS S3 as a zip file.

Topics

amazon-s3amazon-s3-storageaws-php-sdkaws-s3bucketcompressphp-librarys3-buckets3-storagestreamstream-objectszipziparchive

Resources

Readme
MIT license
Activity
Custom properties

Stars

20 stars

Watchers

2 watching

Forks

14 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.