2017 © Pedro Peláez
 

yii2-extension yii2-aws-s3

Contenedor de las clases de S3 para Yii2

image

ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  • Tuesday, October 27, 2015
  • by ctala
  • Repository
  • 0 Watchers
  • 0 Stars
  • 324 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 22 Forks
  • 0 Open issues
  • 16 Versions
  • 138 % Grown

The README.md

Yii2 AWS S3

An Amazon S3Client wrapper as Yii2 component., (*1)

Yii2 AWS S3 can only work with one bucket per a component configuration., (*2)

The component currently supports CloudFront (getting a CDN url for an object in a S3 bucket)., (*3)

Installation

  1. Run the Composer command to install the latest stable version:, (*4)

    composer require ctala/yii2-aws-s3
    
  2. Add component to config/main.php, (*5)

    'components' => [
        // ...
        's3bucket' => [
            'class' => \CTala\Storage::className(),
            'region' => 'your region',
            'credentials' => [ // Aws\Credentials\CredentialsInterface|array|callable
                'key' => 'your aws s3 key',
                'secret' => 'your aws s3 secret',
            ],
            'bucket' => 'your aws s3 bucket',
            'cdnHostname' => 'http://example.cloudfront.net',
            'defaultAcl' => \CTala\Storage::ACL_PUBLIC_READ,
            'debug' => true, // bool|array
        ],
        // ...
    ],
    

Usage

Uploading objects

// creating an object
$data = ['one', 'two', 'three'];
Yii::$app->get('s3bucket')->put('path/to/s3object.ext', Json::encode($data));

// uploading an object by streaming the contents of a stream
$resource = fopen('/path/to/local/file.ext', 'r+');
Yii::$app->get('s3bucket')->put('path/to/s3object.ext', $resource);

Uploading files

Yii::$app->get('s3bucket')->upload('path/to/s3object.ext', '/path/to/local/file.ext');

Uploading large files using multipart uploads with custom options

$concurrency = 5;
$minPartSize = 536870912; // 512 MB

Yii::$app->get('s3bucket')->multipartUpload(
    'path/to/s3object.ext',
    '/path/to/local/file.ext',
    $concurrency,
    $minPartSize
);

Reading objects

/** @var \Aws\Result $result */
$result = Yii::$app->get('s3bucket')->get('path/to/s3object.ext');
$data = $result['Body'];

Saving objects to a file

Yii::$app->get('s3bucket')->get('path/to/s3object.ext', '/path/to/local/file.ext');

Deleting objects

Yii::$app->get('s3bucket')->delete('path/to/s3object.ext');

Getting a plain URL

$url = Yii::$app->get('s3bucket')->getUrl('path/to/s3object.ext');

Creating a pre-signed URL

$url = Yii::$app->get('s3bucket')->getPresignedUrl('path/to/s3object.ext', '+10 minutes');

Getting a CDN URL

$url = Yii::$app->get('s3bucket')->getCdnUrl('path/to/s3object.ext');

Listing objects

$result = Yii::$app->get('s3bucket')->getList('path/');
foreach ($result['Contents'] as $object) {
    echo $object['Key'] . PHP_EOL;
}

ChangeLog

  • 0.6 : Added Create Folder, Added Iterator for All files.

The Versions

27/10 2015

dev-master

9999999-dev https://github.com/ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

27/10 2015

V0.6

0.6.0.0 https://github.com/ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

26/10 2015

0.5.7.1

0.5.7.1 https://github.com/ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

26/10 2015

v0.5.7

0.5.7.0 https://github.com/ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

26/10 2015

v0.5.6.1

0.5.6.1 https://github.com/ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

26/10 2015

v0.5.6

0.5.6.0 https://github.com/ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

26/10 2015

v0.5.4

0.5.4.0 https://github.com/ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

26/10 2015

v0.5.2

0.5.2.0 https://github.com/ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

26/10 2015

v0.5.1

0.5.1.0 https://github.com/ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

26/10 2015

v0.5

0.5.0.0 https://github.com/ctala/yii2-aws-s3

Contenedor de las clases de S3 para Yii2

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

03/06 2015

v0.4.2

0.4.2.0 https://github.com/frostealth/yii2-aws-s3

An Amazon S3Client wrapper as Yii2 component

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

02/06 2015

v0.4.1

0.4.1.0 https://github.com/frostealth/yii2-aws-s3

An Amazon S3Client wrapper as Yii2 component

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

02/06 2015

v0.4.0

0.4.0.0 https://github.com/frostealth/yii2-aws-s3

An Amazon S3Client wrapper as Yii2 component

  Sources   Download

MIT

The Requires

 

yii2 s3 aws-s3

31/05 2015

v0.3.0

0.3.0.0 https://github.com/frostealth/yii2-aws-s3

An Amazon S3Client wrapper as Yii2 component

  Sources   Download

MIT

The Requires

 

The Development Requires

yii2 s3 aws-s3

09/05 2015

v0.2.0

0.2.0.0 https://github.com/frostealth/yii2-aws-s3

Yii2 AWS S3

  Sources   Download

MIT

The Requires

 

by Constantin Chuprik

yii2 s3 aws-s3

30/04 2015

v0.1.0

0.1.0.0

Yii2 AWS S3 component

  Sources   Download

MIT

The Requires

 

by Constantin Chuprik

yii2 s3 aws-s3