jovanialferez / yii2-s3
An Amazon S3Client wrapper as Yii2 component
Installs: 2 857
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 4
Forks: 8
Open Issues: 1
Requires
- aws/aws-sdk-php: 2.6.*
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-05-22 11:03:34 UTC
README
An Amazon S3Client wrapper as Yii2 component.
Usage
return [ // ... 'components' => [ 'storage' => [ 'class' => '\jovanialferez\yii2s3\AmazonS3', 'key' => 'AWS_ACCESS_KEY_ID', 'secret' => 'AWS_SECRET_ACCESS_KEY', 'bucket' => 'YOUR_BUCKET', ], // ... ], ];
You can then start using this component as:
$storage = \Yii::$app->storage; // uploadFile() here returns the resulting S3 url of that file $url = $storage->uploadFile('/path/to/file', 'unique_file_name');