PHP code example of wgenial / s3-objects-stream-zip-php

1. Go to this page and download the library: Download wgenial/s3-objects-stream-zip-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wgenial / s3-objects-stream-zip-php example snippets



  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'; //