定制 grptx/yii2-s3client 二次开发

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

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

grptx/yii2-s3client

Composer 安装命令:

composer require grptx/yii2-s3client

包简介

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock available

Yii2 S3Client based on klinson/aws-s3-minio

Installation

Preferred way to install is through Composer:

php composer.phar require grptx/yii2-s3client:^1

Or, you may add

"grptx/yii2-s3client": "^1"

to the require section of your composer.json file and execute php composer.phar update.

Configuration

in web.php

'components'=> [
    's3client' => [
        'class'=> 'grptx\S3Client',
        'key' => '<your key>',
        'secret' => '<yout secret>',
        'endpoint'=> '<your endpoint>',
        'region' => '<your region>', 
        'defaultBucket' => '<bucket>', //optional default bucket
        'debug' => false, // optional
        'http' => [ //optional
            'verify' => false //use false to self-signed certs
        ],
    ],
],

Usage

/** @var S3Client $s3client */
$s3client = Yii::$app->s3client;

/**
 * put file to minio/s3 server
 * 
 * @param string $localObjectPath full path to file to put
 * @param string|null $storageSavePath full path to file in bucket (optional)
 * @param string|null $bucket the bucket name (optional)
 * @param array $meta (optional)
 * @return Result|bool
 */
$s3client->putObjectByPath(string $localObjectPath, string $storageSavePath = null, string $bucket = null, array $meta = []);

/**
 * create and put a file into minio/s3 server with the specified content
 * 
 * @param string $content
 * @param string $storageSavePath
 * @param string $bucket
 * @param array $meta
 * @return Result|bool
 */
$s3client->putObjectByContent(string $content, string $storageSavePath, string $bucket = null, array $meta = []);

/**
 * get file object from minio/s3 server 
 * 
 * @param string $storageSavePath
 * @param string|null $localSaveAsPath
 * @param string|null $bucket
 * @return bool|mixed
 */
$s3client->getObject(string $storageSavePath, string $localSaveAsPath = null, string $bucket = null)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固