Flysystem AsyncAws S3 Adapter
Store files on Amazon S3 through Flysystem using the lightweight async-aws client.
Repository Health
Technical Analysis
Flysystem AsyncAws S3 Adapter is an official League adapter that lets Flysystem read and write files on Amazon S3 (and S3-compatible stores) using the async-aws/s3 client instead of the heavier official AWS SDK. It plugs into Flysystem’s filesystem abstraction so your application code stays storage-agnostic while gaining a smaller dependency footprint.
The adapter maps Flysystem operations — write, read, delete, list, copy, move, and visibility — onto async-aws S3 API calls, and includes a PortableVisibilityConverter to translate between Flysystem’s public/private visibility and S3 ACLs. It is a drop-in alternative to the aws-sdk-php-backed adapter for teams that want fewer transitive dependencies.
What You Get
- A Flysystem FilesystemAdapter implementation backed by async-aws/s3
- Full file operations: write, read, delete, copy, move, and directory listing
- A PortableVisibilityConverter mapping public/private visibility to S3 ACLs
- MIME-type detection via league/mime-type-detection
- A lighter dependency footprint than the official aws-sdk-php adapter
Common Use Cases
- Storing user uploads and generated files on Amazon S3 from a PHP app
- Targeting S3-compatible object stores (MinIO, DigitalOcean Spaces) through Flysystem
- Swapping the AWS SDK for the smaller async-aws client to trim dependencies
- Keeping storage code portable so you can switch between local, S3, and other backends
Under The Hood
Architecture - The package centers on AsyncAwsS3Adapter.php, which implements Flysystem’s FilesystemAdapter interface. Each interface method (write, read, delete, deleteDirectory, createDirectory, copy, move, listContents, visibility, fileExists) is translated into the corresponding async-aws/s3 client call, with keys resolved through a configurable path prefix. A VisibilityConverter abstraction (with PortableVisibilityConverter as the default) bridges Flysystem’s public/private model to S3 object ACLs, and mime-type detection sets content types on writes.
Tech Stack - PHP 8.0.2+, depending on league/flysystem (^3.10), async-aws/s3 for the S3 API client, and league/mime-type-detection. It declares a conflict with symfony/http-client < 5.2 (the transport async-aws uses).
Code Quality - The code is compact and single-responsibility, matching the established Flysystem adapter contract. Tests live alongside the source (AsyncAwsS3AdapterTest.php) with an S3ClientStub for exercising operations without a live bucket, following the same conventions as the other League S3 adapter.
API Design - Developers never call the adapter directly; they construct it once with an async-aws S3Client, bucket, and optional prefix, then hand it to a Flysystem Filesystem. From there all interaction is through Flysystem’s portable API, so switching from the AWS SDK adapter to this one is essentially a construction-time change with no downstream code edits.