farhan928/yii2-aws-s3-client
最新稳定版本:1.0.2
Composer 安装命令:
composer require farhan928/yii2-aws-s3-client
包简介
Yii2 wrapper extension for aws sdk s3 client
README 文档
README
The Yii2 AWS S3Client is a wrapper for AWS S3Client SDK for PHP.
Installation
The preferred way to install this extension is through composer.
Pre-requisites
You must have composer installed on your machine.
Install
Either run
$ composer require farhan928/yii2-aws-s3-client "^1.0.0"
or add
"farhan928/yii2-aws-s3-client": "^1.0.0"
to the require section of your composer.json file.
Release Changes
NOTE: Refer the CHANGE LOG for details on changes to various releases.
Usage
Add this code below to your main config and your are ready to go.
// add this in your component section 's3Client' => [ 'class' => 'farhan928\AwsS3\S3Client', 'key' => 'YOUR_AWS_KEY', 'secret' => 'YOUR_AWS_SECRET', 'bucket' => 'YOUR_BUKCET', ],
Examples
Get object URL
Yii::$app->s3Client->url('file.png');
Generate and get temporary URL
Yii::$app->s3Client->temporaryUrl('file.png', 5); //second argument is the duration in minute
Upload raw file contents on bucket
Yii::$app->s3Client->put('file.png', file_get_contents('https://i.imgur.com/hAjCMan.jpg'))
Copy object to new location
Yii::$app->s3Client->copy('old.png', 'file/new.png')
Move object to new location
Yii::$app->s3Client->move('old.png', 'file/new.png')
Get all files from a directory
// get all files Yii::$app->s3Client->files('path/to/your/folder/'); // get certain type of files Yii::$app->s3Client->files('path/to/your/folder/', ['jpg', 'png']);
License
yii2-aws-s3-client is released under the BSD-3-Clause License
Related Links
统计信息
- 总下载量: 928
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-02-14