indielab/yii2s3 问题修复 & 功能扩展

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

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

indielab/yii2s3

最新稳定版本:2.1.1

Composer 安装命令:

composer require indielab/yii2s3

包简介

Yii 2 S3 Component

关键字:

README 文档

README

This component allows you to work with the amazon AWS S3 buckets for uploading and finding files.

Installation

Add the the package to your composer file:

composer require indielab/yii2s3

Add the component to your application configuration file:

'components' => [
    // ...
    's3' => [
        'class' => \indielab\yii2s3\S3::class,
        'bucket' => 'mybucket',
        'key' => 'KEY',
        'secret' => 'SECRET',
        'region' => 'eu-central-1',
    ],
    // ...
]

Usage

Using the component in order to upload a file:

Yii::$app->s3->upload('path/to/the/file.jpg');

Where file.jpg will be used as the key of the uploading file. Now in order to get the url to a key use:

$url = Yii::$app->s3->url('file.jpg');

Configure Uploading

You can also provide more options to the uploading configuration method:

Yii::$app->s3->upload('path/to/the/file.jpg', [
    'override' => true, // whether existing file should be overriden or not
    'Key' => 'CacheControlTestFile.txt', // Define a specific name for the file instead of the source file name
    'CacheControl' => 'max-age=' . strtotime('+1 year')  // Add cache controler options
]);

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-11-18