PHPackages                             ssigwart/aws-high-availability-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. ssigwart/aws-high-availability-s3

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

ssigwart/aws-high-availability-s3
=================================

Library to make high availability S3 calls.

v1.0.1(2y ago)1321MITPHPPHP &gt;=8.0.0

Since Nov 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ssigwart/aws-high-availability-s3)[ Packagist](https://packagist.org/packages/ssigwart/aws-high-availability-s3)[ Docs](https://github.com/ssigwart/aws-high-availability-s3)[ RSS](/packages/ssigwart-aws-high-availability-s3/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (1)

AWS High Availability S3
========================

[](#aws-high-availability-s3)

This library makes it easy to write files to S3 with high availability. It includes the following features:

- Upload an S3 file to the first successful file location.
- Download an S3 file that is available in multiple file locations.

Usage
-----

[](#usage)

The APIs require you to pass in an `\Aws\Sdk` object. In the examples below, `$awsSdk` is used for this object.

### Uploading a File

[](#uploading-a-file)

1. Create a list of available upload locations.
    - This is an `S3AvailableUploadFileBucketAndKeyLocations` object.
    - You can add anything that implements `S3FileBucketAndKeyProviderInterface` to the list of locations.
    - The simplest option is to use `S3FileBucketAndKey`, which implements this interface.
2. Set up `S3UploadFileMetadata` with metadata for the file to be uploaded.
3. Create an `AwsHighAvailabilityS3Uploader` object and call `uploadFileToS3`.
    - You can configure the uploader with an `AwsHighAvailabilityS3UploaderErrorHandlerInterface` to customize handling of failures. For example, you might want to use it to log the exception or you can throw an exception if you want to stop attempted alternative locations.

```
// Set up possible locations
$primaryLocation = new S3FileBucketAndKey('us-east-1', 'phpunit-test-us-east-1', 'us-east-1/path/to/file.txt');
$backupLocation = new S3FileBucketAndKey('us-west-1', 'phpunit-test-us-west-1', 'us-west-1/path/to/file.txt');
$locations = new S3AvailableUploadFileBucketAndKeyLocations($primaryLocation);
$locations->addAlternativeLocation($backupLocation);

// Set up meta data
$metadata = new S3UploadFileMetadata();

// Upload
$s3Uploader = new AwsHighAvailabilityS3Uploader($awsSdk);
$finalLocation = $s3Uploader->uploadFileToS3($locations, 'File contents.', 'text/plain', $metadata);
```

### Downloading a File

[](#downloading-a-file)

1. Create a list of available download locations.
    - This is an `S3AvailableDownloadFileBucketAndKeyLocations` object.
    - You can add anything that implements `S3FileBucketAndKeyProviderInterface` to the list of locations.
    - The simplest option is to use `S3FileBucketAndKey`, which implements this interface.
2. Create an `AwsHighAvailabilityS3Downloader` object and call `downloadFileFromS3`.
    - You can configure the downloader with an `AwsHighAvailabilityS3DownloaderErrorHandlerInterface` to customize handling of failures. For example, you might want to use it to log the exception or you can throw an exception if you want to stop attempted alternative locations.

```
// Set up possible locations
$primaryLocation = new S3FileBucketAndKey('us-east-1', 'phpunit-test-us-east-1', 'us-east-1/path/to/file.txt');
$backupLocation = new S3FileBucketAndKey('us-west-1', 'phpunit-test-us-west-1', 'us-west-1/path/to/file.txt');
$locations = new S3AvailableDownloadFileBucketAndKeyLocations($primaryLocation);
$locations->addAlternativeLocation($backupLocation);

// Download
$s3Downloader = new AwsHighAvailabilityS3Downloader($awsSdk);
$contents = $s3Downloader->downloadFileFromS3($locations);
```

### `S3UploadFileMetadata` Options

[](#s3uploadfilemetadata-options)

The `S3UploadFileMetadata` class allows you to customize the following:

- S3 storage class.
- S3 ACL (public vs private).
- Cache TTL for public objects.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

Every ~13 days

Total

2

Last Release

895d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b2f76908d7b9f63ead4e897d83ed03b73ab603778f710c05b302f1154a858c72?d=identicon)[ssigwart](/maintainers/ssigwart)

---

Top Contributors

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

---

Tags

s3awshigh availabilityHAmulti-region

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ssigwart-aws-high-availability-s3/health.svg)

```
[![Health](https://phpackages.com/badges/ssigwart-aws-high-availability-s3/health.svg)](https://phpackages.com/packages/ssigwart-aws-high-availability-s3)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M788](/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.7k35.6M75](/packages/aws-aws-sdk-php-laravel)[aws/aws-sdk-php-resources

A resource-oriented API for interacting with AWS services

1381.8M10](/packages/aws-aws-sdk-php-resources)[vinelab/cdn

Content Delivery Network (CDN) Package for Laravel

217240.8k1](/packages/vinelab-cdn)[aws/aws-sdk-php-zf2

Zend Framework 2 Module that allows easy integration the AWS SDK for PHP

104997.5k5](/packages/aws-aws-sdk-php-zf2)[frostealth/yii2-aws-s3

An Amazon S3 component for Yii2

90698.9k5](/packages/frostealth-yii2-aws-s3)

PHPackages © 2026

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