定制 idapgroup/s3-storage-sdk 二次开发

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

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

idapgroup/s3-storage-sdk

最新稳定版本:1.0.0

Composer 安装命令:

composer require idapgroup/s3-storage-sdk

包简介

A PHP wrapper for S3 Storage

关键字:

README 文档

README

S3 Storage SDK for working with AWS S3 Storage.

Documentation

The documentation for the AWS S3 Storage Api can be found here.

Installation

The preferred way to install this extension is through composer.

Either run

composer require idapgroup/s3-storage-sdk

or add

{
  "require": {
      "idapgroup/s3-storage-sdk": "^1.0.0"
  }
}

to the requirement section of your composer.json file.

Quickstart

Create a S3 Storage

<?php

require 'vendor/autoload.php';

use IdapGroup\S3StorageSdk\Storage\S3Storage;

$s3Client = new S3Client([
            'region' => 'S3_REGION',
            'version' => 'S3_API_VERSION',
            'credentials' => [
                'key' => 'S3_KEY',
                'secret' => 'S3_SECRET'
            ],
        ]);

$readStorage = new S3Storage($s3Client, 'S3_READ_BUCKET', 'S3_REGION');
$writeStorage = new S3Storage($s3Client, 'S3_WRITE_BUCKET', 'S3_REGION');

Examples

Save file

// Create an instance of class that implements UploadedFileInterface
$file = new UploadedFile();
$readStorage->save($file, 'filename');

Transfer the file to the file storage

// Create an instance of class that implements S3FileInterface or extends S3File
$imageFile = new S3File('file_path', $writeStorage->getBucket());
$readStorage->transfer($imageFile);

Delete the file from the file storage

$readStorage->delete('file_path');

Check the existence of the file in the file storage

$readStorage->has('file_path');

Get the file

$readStorage->get('file_path');

Get the bucket name

$bucketName = $readStorage->getBucket();

Get the bucket region

$bucketRegion = $readStorage->getRegion();

Build URL to manual upload a file

$bucketName = $writeStorage->buildPutUrl('filename');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2023-02-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固