PHPackages                             rayanlevert/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. rayanlevert/s3

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

rayanlevert/s3
==============

Simpler with typed methods wrapper over the S3 SDK from AWS for handling buckets

v3.0(1y ago)013[1 issues](https://github.com/rayanlevert/s3/issues)BSD-3-ClausePHPPHP 8.4.\*

Since Oct 5Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/rayanlevert/s3)[ Packagist](https://packagist.org/packages/rayanlevert/s3)[ RSS](/packages/rayanlevert-s3/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (4)Versions (14)Used By (0)

Amazon's SDK typed and documented wrapper class handling S3 object storages
===========================================================================

[](#amazons-sdk-typed-and-documented-wrapper-class-handling-s3-object-storages)

[![Packagist Version](https://camo.githubusercontent.com/20b9ba1686a3d13e1d30ae6825c2ca7d9a2d262a68e9bd5ddf1029dbe5ccd9a8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726179616e6c65766572742f7333)](https://packagist.org/packages/rayanlevert/s3)[![PHP from Packagist](https://camo.githubusercontent.com/90f824d2ae3f184b6e0baaac8a3c73b2430a98eb57bfa18586073d2d3646e551/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726179616e6c65766572742f7333)](https://packagist.org/packages/rayanlevert/s3)

> Version **3.0** supports only **php8.4** with all brand new features, for &gt;= **php8.1**, version **2.0** is still supported.

How to use the class
--------------------

[](#how-to-use-the-class)

### Construct

[](#construct)

```
// Initializes the client with credentials, endpoint to the API and server location
$oS3 = new \RayanLevert\S3\S3('accessKey', 'secretKey', 'endpoint', 'region');

/**
 * A 5th argument can be passed if you are going to use the same bucket from the instance
 * you don't need to pass the bucket name to each method ;)
*/
$oS3 = new \RayanLevert\S3\S3('accessKey', 'secretKey', 'endpoint', 'region', 'bucketName');

// If you prefer to have all infos in an associative array, ::fromArray() is available
$oS3 = \RayanLevert\S3\S3::fromArray([
    'key'      => 'accessKey',
    'secret'   => 'secretKey',
    'endpoint' => 'endpoint-url',
    'region'   => 'region-dev',
    'bucket'   => 'bucketName' // optional if multiple buckets will be used
]);
```

API methods
-----------

[](#api-methods)

> Argument `$bucketName` is not mandatory if `$bucketName` has been passed to the constructor

```
// If a bucket exists
public function doesBucketExist(string $bucketName = ''): bool;

// If an object exists by its bucket and key name
public function doesObjectExist(string $keyName, string $bucketName = ''): bool;

// Creates a bucket
public function createBucket(string $bucketName = ''): void

// Creates an object from a string
public function putObject(string $content, string $keyName, string $contentType, string $bucketName = ''): void

// Creates a object from a local file
public function putFile(string $filePath, string $keyName, string $contentType, string $bucketName = ''): void

// Returns an `\Aws\Result` instance from a key (throws an exception if not found)
public function getObject(string $key, string $bucketName = ''): \Aws\Result

// Returns the content of an object (throws an exception if not found)
public function getObjectContent(string $key, string $bucketName = ''): string

// Deletes a bucket (throws an exception if still objects remain in the bucket)
public function deleteBucket(string $bucketName = ''): bool

// Deletes an object (continues and returns false if the object didn't exist, true if it did)
public function deleteObject(string $keyName, string $bucketName = ''): bool

// @return array Returns buckets and/or objects created from the instance (bucketName -> array of key names)
public function getObjects(): array;
```

Development / Docker
--------------------

[](#development--docker)

> Uses [RustFS](https://github.com/rustfs/rustfs), open source object storage for local development (unit tests)

1. Copy [.env.example](.env.example) to `.env`
2. Start containers (`docker compose up -d`), for PHP and one for MinIO
3. Start `docker compose exec s3 bash` to access to the PHP
4. Run `composer install` to retrieve **vendors**
5. Go to  and connect by using username and password (`rustfsadmin` by default)
6. Go to `Access Keys`, generate access and secret key and put them in `.env` file
7. Restart containers updating `.env` file and you are good to go !

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance50

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 55.6% 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

Every ~108 days

Recently: every ~161 days

Total

7

Last Release

350d ago

Major Versions

v1.2.1 → v3.02025-07-01

PHP version history (3 changes)v1.0.0PHP &gt;=7.4

v3.0PHP 8.4.\*

v2.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/7253402d616a4792e6733113363a7f6918d318fb2b68fce60e5eb6d715319d69?d=identicon)[rayanlevert](/maintainers/rayanlevert)

---

Top Contributors

[![rayanlevert](https://avatars.githubusercontent.com/u/78140431?v=4)](https://github.com/rayanlevert "rayanlevert (30 commits)")[![rlevert-dis](https://avatars.githubusercontent.com/u/83226311?v=4)](https://github.com/rlevert-dis "rlevert-dis (24 commits)")

---

Tags

phps3phps3wrapper

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.7k285.7M1.0k](/packages/league-flysystem-aws-s3-v3)[aws/aws-sdk-php-laravel

A simple Laravel 9/10/11/12/13 service provider for including the AWS SDK for PHP.

1.7k38.2M84](/packages/aws-aws-sdk-php-laravel)[kolay/xlsx-stream

Streaming XLSX reader and writer for PHP and Laravel. Constant memory regardless of file size, direct S3 multipart streaming, optional born-indexed random access.

437.9k](/packages/kolay-xlsx-stream)[jmathai/s3-bucket-stream-zip-php

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

56114.9k](/packages/jmathai-s3-bucket-stream-zip-php)[matecat/simple-s3

Simple S3 Client

1319.4k](/packages/matecat-simple-s3)[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)
