grigorieff/yii2-aws 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

grigorieff/yii2-aws

Composer 安装命令:

composer require grigorieff/yii2-aws

包简介

Yii2 component for Amazon Web Service

README 文档

README

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist grigorieff/yii2-aws "master-dev"

or add

"grigorieff/yii2-aws": "*"

to the require section of your composer.json.

Configuration

Add to your app config:

    'components' => [

        .........

        'aws' => [
            'class' => grigorieff\aws\AWSComponent,
            'key' => '......',
            'secret' => '......',
            'region' => '......'
        ],

        .........

    ];

Usage

$aws = Yii::$app->aws;

// AWS S3

$s3 = $aws->get('s3');

try {
    $s3->putObject(array(
        'Bucket' => 'my-bucket',
        'Key'    => 'my-object',
        'Body'   => fopen('/path/to/file', 'r'),
        'ACL'    => 'public-read',
    ));
} catch (S3Exception $e) {
    echo "There was an error uploading the file.\n";
}

......

try {
    $resource = fopen('/path/to/file', 'r');
    $s3->upload('my-bucket', 'my-object', $resource, 'public-read');
} catch (S3Exception $e) {
    echo "There was an error uploading the file.\n";
}

......

$s3->getObject(array(
    'Bucket' => $bucket,
    'Key'    => 'data.txt',
    'SaveAs' => '/tmp/data.txt'
));
echo $result['Body']->getUri() . "\n";

统计信息

  • 总下载量: 328
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-12-21