jenn0pal/yii2-aws-sdk
最新稳定版本:1.0.1
Composer 安装命令:
composer require jenn0pal/yii2-aws-sdk
包简介
Yii2 AWS Sdk v3 wrapper.
README 文档
README
======================== Yii2 AWS Sdk V3 wrapper
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require jenn0pal/yii2-aws-sdk "*"
or add
"jenn0pal/yii2-aws-sdk": "*"
to the require section of your composer.json file.
in your web.php, your configuration would look like this
'components' => [ 'aws' => [ 'class' => 'jenn0pal\aws\BaseAws', //required config 'region' => 'your_region', //optional config 'key' => 'your_key', 'secret' => 'your_secret', 'version' => 'latest', //additional config 'options' => [ 'scheme' => 'http', ], // optional config file //'configFile' => require_once('/path/to/aws.config.php'), ] ]
See additional aws configuration here
Warning! It is not recommended to hard code your credentials on your app config because you may accidentally commit it in your VCS, potentially exposing it to more people than intended. See additional ways here
Usage
Once the extension is installed, simply use it in your code by :
/* @var $aws \jenn0pal\aws\AwsSdk */ $aws = \Yii::$app->aws; $dynamoDbClient = $aws->createDynamoDb(); ... $s3Client = $aws->createS3(); $result = $s3Client->listObjects(['Bucket' => 'my-bucket'])->toArray(); //get the last object $object = end($result['Contents']); $key = $object['Key']; $file = $s3Client->getObject([ 'Bucket' => 'my-bucket', 'Key' => $key ]); //download file header('Content-Type: ' . $file['ContentType']); echo $file['Body'];
统计信息
- 总下载量: 33.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-08