定制 farhan928/yii2-aws-s3-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

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

@raditzfarhan on Twitter

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-02-14