mag/s3

S3 Uploader for Yii2 Framework

dev-master 2015-06-14 17:04 UTC

This package is not auto-updated.

Last update: 2025-09-13 21:03:25 UTC


README

This extension provides upload to S3 files in Yii Framework 2. It is a wrapper for AWS SDK for PHP (@link https://github.com/aws/aws-sdk-php)

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require mag/S3 "dev-master"

or add

"mag/S3": "dev-master"

to the require section of your composer.json file.

Use

add in config:

'components' => [
        's3' => [
            'class'     => 'mag/S3',
            'key'       => 'Your access key from amazon',
            'secret'    => 'Your secret key from amazon',
            'bucket'    => 'Bucket name',
        ],
        ...

And you can use it:

\Yii::$app->s3->upload('/home/username/Pictures/P1010238.JPG', 'test/my.jpg');

first param is local file name second param is file name on Amazon S3 server. It can include directories.