2017 © Pedro Peláez
 

yii2-extension yii2s3

Yii 2 S3 Component

image

indielab/yii2s3

Yii 2 S3 Component

  • Friday, December 2, 2016
  • by nadar
  • Repository
  • 2 Watchers
  • 1 Stars
  • 1,311 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 16 % Grown

The README.md

Yii 2 Amazon S3 Component

This component allows you to work with the amazon AWS S3 buckets for uploading and finding files., (*1)

Installation

Add the the package to your composer file:, (*2)

composer require indielab/yii2s3

Add the component to your application configuration file:, (*3)

'components' => [
    // ...
    's3' => [
        'class' => \indielab\yii2s3\S3::class,
        'bucket' => 'mybucket',
        'key' => 'KEY',
        'secret' => 'SECRET',
        'region' => 'eu-central-1',
    ],
    // ...
]

Usage

Using the component in order to upload a file:, (*4)

Yii::$app->s3->upload('path/to/the/file.jpg');

Where file.jpg will be used as the key of the uploading file. Now in order to get the url to a key use:, (*5)

$url = Yii::$app->s3->url('file.jpg');

Configure Uploading

You can also provide more options to the uploading configuration method:, (*6)

Yii::$app->s3->upload('path/to/the/file.jpg', [
    'override' => true, // whether existing file should be overriden or not
    'Key' => 'CacheControlTestFile.txt', // Define a specific name for the file instead of the source file name
    'CacheControl' => 'max-age=' . strtotime('+1 year')  // Add cache controler options
]);

The Versions

02/12 2016

dev-master

9999999-dev https://github.com/indielab

Yii 2 S3 Component

  Sources   Download

The Requires

 

The Development Requires

s3

02/12 2016

1.0.0

1.0.0.0 https://github.com/indielab

Yii 2 S3 Component

  Sources   Download

The Requires

 

The Development Requires

s3