定制 mafordham/aws-s3 二次开发

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

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

mafordham/aws-s3

最新稳定版本:v1.0.0

Composer 安装命令:

composer require mafordham/aws-s3

包简介

A simple, bare-bones S3 helper class

README 文档

README

A lightweight PHP class to interact directly with Amazon S3. No AWS SDK, no AWS CLI — just PHP communicating directly with the AWS REST API.

This class supports common S3 operations like uploading, downloading, listing, and deleting objects. It also supports Composer autoloading for easy integration into modern PHP projects.

Features

  • Direct communication with AWS S3 REST API
  • No external libraries required (but supports Composer)
  • Simple, easy-to-use methods
  • Secure AWS request signing

Installation

You can include the class manually:

require_once 'src/AwsS3.php';

Or use Composer autoloading by adding the src/ directory to your composer.json:

{
  "autoload": {
    "psr-4": {
      "MaFordham\\AwsS3\\": "src/"
    }
  }
}

Then run:

composer dump-autoload

and load the class using PSR-4 autoloading.

Configuration

Create a new instance of AwsS3 with your AWS credentials and region:

use YourNamespace\\AwsS3\\AwsS3;

$s3 = new AwsS3([
    'access_key' => 'YOUR_AWS_ACCESS_KEY',
    'secret_key' => 'YOUR_AWS_SECRET_KEY',
    'region'     => 'us-east-1',
]);
  • ⚠️ Keep your AWS credentials secure and never commit them to source control.

Usage

List Buckets

$objects = $s3->objectsList();
print_r($objects);

Upload a File

$s3->objectPut('my-bucket', '/remote/path/file.txt', 'image/png', base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO/tO7sAAAAASUVORK5CYII='));

Download a File

$s3->objectGet('my-bucket', '/remote/path/file.txt');

Delete an Object

$s3->objectDelete('my-bucket', '/remote/path/file.txt');

Public URL for an Object

$s3->objectUrl('my-bucket', '/remote/path/file.txt');

Security

  • Always store your AWS credentials securely
  • Consider using environment variables or a .env file
  • Do not commit secrets into the repository

Contributing

Pull requests and issues are welcome. Please follow the standard PR workflow.

License

This project is licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固