PHPackages                             pvmlibs/simple-s3 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. pvmlibs/simple-s3

ActiveLibrary[File &amp; Storage](/categories/file-storage)

pvmlibs/simple-s3
=================

Lightweight S3 connector for PHP

1.0.0(4mo ago)01MITPHPPHP &gt;=8.1CI passing

Since Jan 7Pushed 4mo agoCompare

[ Source](https://github.com/pvmlibs/simple-s3)[ Packagist](https://packagist.org/packages/pvmlibs/simple-s3)[ RSS](/packages/pvmlibs-simple-s3/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

[![CI Status](https://github.com/pvmlibs/simple-s3/actions/workflows/tests.yml/badge.svg)](https://github.com/pvmlibs/simple-s3/actions)[![codecov](https://camo.githubusercontent.com/6b8e908f253738fa97c52470ead5d3a46931bcbc351543d7619fe32a2158433d/68747470733a2f2f636f6465636f762e696f2f67682f70766d6c6962732f73696d706c652d73332f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4e454431433255455744)](https://codecov.io/gh/pvmlibs/simple-s3/branch/master)

Simple, lightweight S3 connector for PHP
========================================

[](#simple-lightweight-s3-connector-for-php)

If you need just basic file operations for S3-compatible services, official AWS SDK seems overkill as it weights ~50MB (~4MB ofter stripping all non-essential services) and just loading it takes 15,03MB of RAM + 0,72MB for request to list bucket objects. This library is ~40kB in source size and uses 0,055MB of RAM (client object + request to list bucket objects).

Features:

1. Uses only curl extension
2. Supports asynchronous mode (\*Async methods)
3. Supports streaming
4. Actions:
    - getObject
    - putObject
    - headObject
    - deleteObject
5. Custom actions - assemble your own action e.g. list bucket objects

Requirements
------------

[](#requirements)

1. PHP &gt;= 8.1
2. curl extension

Installation
------------

[](#installation)

```
composer require pvmlibs/simple-s3
```

Usage
-----

[](#usage)

For domain use following schema:

1. `s3..amazonaws.com` for AWS
2. `.r2.cloudflarestorage.com` for R2

For AWS, bucket name can't include dot (.), otherwise it can't use tls (work with tls: false). R2 doesn't allow for dots in bucket name so problem don't exist here.

```
$client = new S3Client(/* credentials */);

// synchronous request with streaming to temp file
$response = $client->getObject(bucketPath: 'test.txt');
if ($response->success()) {
    readfile($response->getResponseFilePath());
    // or use resource
    echo fread($response->getResponseResource(), 1000);
}

// synchronous request with streaming directly to custom file
$response = $client->getObject(bucketPath: 'test.txt', customStreamFile: '/var/www/target.txt');

// synchronous request without streaming
$response = $client->getObject(bucketPath: 'test.txt');
if ($response->success()) {
    // no resource pointer available
    echo $response->getResponse();
}

// asynchronous request without streaming
$client->getObjectAsync(bucketPath: 'test-a.txt')
        ->setCustomData(['foo' => 'bar'] // optional
        ->then(function (HttpResponseInterface $response, array $customData): void {
            // do sth on success, $customData is from setCustomData
         })
         ->catch(function (HttpResponseInterface $response, array $customData): void {
            // do sth on fail, $customData is from setCustomData
         });

// you can schedule multiple async requests, but they won't be executed until you call this:
// notice: when calling synchronous methods, it will automatically execute all previously scheduled async methods
$client->waitForRequests();

// upload local file, $contentType will be evaluated from file extension if not provided
$response = $client->putObject(bucketPath: 'test.txt', localFile: '/var/www/source.txt');

// upload local file from resource, $contentType will be evaluated from file extension associated to resource if not provided
$f = fopen('/var/www/source.txt');
$response = $client->putObject(bucketPath: 'test.txt', localFile: $f);
fclose($f);

// upload from string data, $contentType is required
$response = $client->putObjectFromBuffer(bucketPath: 'test.txt', data: 'foo', contentType: 'text/plain');

// custom action, this will list bucket objects
// you can pass additional headers like x-amz-security-token per action to promise here or globally per client in $client->setHeaders()
$response = $client->customAction(new HttpPromise(
            action: 'GET',
            path: '',
            domain: $client->getDomain(),
            query: ['list-type' => 2],
        ));
if ($response->success()) {
    // proceed with xml data from $response->getResponse()
}
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance82

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

121d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/51d65b54b347cdf356cb75ec7180e480e35f6b6013626e25378dfc79867dabb2?d=identicon)[pvmlibs](/maintainers/pvmlibs)

---

Top Contributors

[![pvmlibs](https://avatars.githubusercontent.com/u/234595918?v=4)](https://github.com/pvmlibs "pvmlibs (4 commits)")

---

Tags

phps3Simplelightweightr2

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pvmlibs-simple-s3/health.svg)

```
[![Health](https://phpackages.com/badges/pvmlibs-simple-s3/health.svg)](https://phpackages.com/packages/pvmlibs-simple-s3)
```

###  Alternatives

[eddturtle/direct-upload

Composer Package to build an AWS Signature ready to Direct Upload to S3

88728.1k2](/packages/eddturtle-direct-upload)[jmathai/s3-bucket-stream-zip-php

PHP library to efficiently stream contents from an AWS S3 bucket or folder as a zip file

56114.4k](/packages/jmathai-s3-bucket-stream-zip-php)[unisharp/s3-presigned

An AWS S3 package for pre-signed upload purpose in Laravel and PHP.

141.8k](/packages/unisharp-s3-presigned)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
