PHPackages                             elgigi/flysystem-useful-adapters - 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. elgigi/flysystem-useful-adapters

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

elgigi/flysystem-useful-adapters
================================

Useful adapters for Flysystem PHP library

v1.1.0(1mo ago)620.9k↓27.5%MITPHPPHP ^8.0CI passing

Since Mar 14Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/ElGigi/FlysystemUsefulAdapters)[ Packagist](https://packagist.org/packages/elgigi/flysystem-useful-adapters)[ RSS](/packages/elgigi-flysystem-useful-adapters/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (3)Dependencies (12)Versions (4)Used By (0)

FlysytemUsefulAdapters
======================

[](#flysytemusefuladapters)

[![Latest Version](https://camo.githubusercontent.com/e21e1f549695ae10d9e8bb3f5b2bff83a5261b87113bc074b594d9f10b3af1ea/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c676967692f666c7973797374656d2d75736566756c2d61646170746572732e7376673f7374796c653d666c61742d737175617265)](https://github.com/ElGigi/FlysystemUsefulAdapters/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/50b9fcef7f3616730aca054a6a1f498e4b5401cf62038b92973df62565710ecb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f456c476967692f466c7973797374656d55736566756c41646170746572732f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://github.com/ElGigi/FlysystemUsefulAdapters/actions/workflows/tests.yml?query=branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/93e223b592a5b54a5ae6f0dd770d8e5d6dee2533419798088ff04cb7cc3d8ee3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c676967692f666c7973797374656d2d75736566756c2d61646170746572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elgigi/flysystem-useful-adapters)

This extension adds some useful adapters for the [`league/flysystem`](https://github.com/thephpleague/flysystem) library.

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

[](#installation)

You can install the client with [Composer](https://getcomposer.org/):

```
composer require elgigi/flysystem-useful-adapters
```

Adapters
--------

[](#adapters)

### FallbackAdapter

[](#fallbackadapter)

The `FallbackAdapter` allows you to read from or write to a fallback adapter when the primary one fails.

Imagine that your main adapter is an S3 bucket in an unavailable region; to continue to receive files from your customers, you can use a fallback adapter on another region.

Adapters are tried in the order they are given until one succeeds. If every adapter throws, the last exception is rethrown.

```
use ElGigi\FlysystemUsefulAdapters\FallbackAdapter;
use League\Flysystem\Filesystem;

// First argument is the primary adapter, the following ones are fallbacks (tried in order)
$adapter = new FallbackAdapter($primaryAdapter, $fallbackAdapter, $anotherFallbackAdapter);

$fs = new Filesystem($adapter);
```

### IgnoreFilesystemAdapter

[](#ignorefilesystemadapter)

The `IgnoreFilesystemAdapter` decorates an adapter and filters entries based on `.gitignore`-style ignore files (e.g. `.docignore`). Patterns follow the gitignore syntax (negation with `!`, anchoring with `/`, `**`, directory-only with a trailing `/`, character classes…) and are resolved as a cascade: an ignore file placed in a subdirectory applies to that subtree, overriding the rules of parent directories.

```
use ElGigi\FlysystemUsefulAdapters\IgnoreFilesystemAdapter;
use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter;

$inner = new LocalFilesystemAdapter('/path');

// Read rules from .docignore files
$adapter = new IgnoreFilesystemAdapter($inner, '.docignore');

// Several ignore filenames can be provided (rules are concatenated in order)
$adapter = new IgnoreFilesystemAdapter($inner, ['.docignore', '.exportignore']);

$fs = new Filesystem($adapter);
```

The third argument `$strict` (default `true`) controls how ignored paths behave:

- `$strict = true`: an ignored path is treated as if it does not exist for **every** operation (`read`/`write`/metadata throw the relevant exception, `fileExists` returns `false`, `delete` is a no-op).
- `$strict = false`: only `listContents()` is filtered; direct accesses are passed through to the inner adapter.

```
$adapter = new IgnoreFilesystemAdapter($inner, '.docignore', strict: false);
```

The ignore files themselves are always hidden from `listContents()` but remain readable.

### LogAdapter

[](#logadapter)

The `LogAdapter` is compliant with `psr/log` and allows you to log actions performed on a filesystem.

Each operation is logged with a level that depends on its nature: write-type operations (`write`, `writeStream`, `copy`, `move`, `delete`, `deleteDirectory`, `createDirectory`, `setVisibility`) are logged at the `notice` level, read and metadata operations at the `debug` level, and any failure at the `error` level.

```
use ElGigi\FlysystemUsefulAdapters\LogAdapter;
use League\Flysystem\Filesystem;

// $logger is any PSR-3 Psr\Log\LoggerInterface implementation
$adapter = new LogAdapter($innerAdapter, $logger);

// The logger can also be injected later via setLogger()
$adapter = new LogAdapter($innerAdapter);
$adapter->setLogger($logger);

$fs = new Filesystem($adapter);
```

### ReadWriteAdapter

[](#readwriteadapter)

The `ReadWriteAdapter` allows you to separate reader and writer adapters.

Write methods (`write`, `writeStream`, `delete`, `copy`, `move`, `createDirectory`, `deleteDirectory`, `setVisibility`) are routed to the writer adapters, while all other (read/metadata) methods are routed to the reader adapters. Readers are automatically wrapped as read-only to ensure no write happens through them. At least one reader and one writer are required.

```
use ElGigi\FlysystemUsefulAdapters\ReadWriteAdapter;
use League\Flysystem\Filesystem;

$adapter = new ReadWriteAdapter(
    readers: [$readReplicaAdapter],
    writers: [$primaryAdapter],
);

$fs = new Filesystem($adapter);
```

### RetryAdapter

[](#retryadapter)

The `RetryAdapter` allows you to retry an action on a filesystem in case of failure, after a delay and a given number of times.

The second argument `$time` is the delay between attempts, in **milliseconds** (default `5000`). The third argument `$retry` is the total number of attempts (default `2`, minimum `1`). The fourth argument `$multiplier` (default `1.0`, minimum `1`) applies an exponential backoff: the delay for attempt `n` is `time * multiplier^n` (e.g. with `time: 1000` and `multiplier: 2.0`, delays are 1000 ms, then 2000 ms, then 4000 ms…). A multiplier of `1.0` keeps a constant delay. No delay is applied after the last attempt; if all attempts fail, the last exception is rethrown.

```
use ElGigi\FlysystemUsefulAdapters\RetryAdapter;
use League\Flysystem\Filesystem;

// Retry up to 3 times, waiting 1000 ms between attempts
$adapter = new RetryAdapter($innerAdapter, time: 1000, retry: 3);

// Exponential backoff: 1000 ms, then 2000 ms between attempts
$adapter = new RetryAdapter($innerAdapter, time: 1000, retry: 3, multiplier: 2.0);

$fs = new Filesystem($adapter);
```

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.5% 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 ~406 days

Total

3

Last Release

31d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18268216?v=4)[Ronan Giron](/maintainers/ElGigi)[@ElGigi](https://github.com/ElGigi)

---

Top Contributors

[![ElGigi](https://avatars.githubusercontent.com/u/18268216?v=4)](https://github.com/ElGigi "ElGigi (21 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (1 commits)")

---

Tags

flysystem-adapterflysytemphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/elgigi-flysystem-useful-adapters/health.svg)

```
[![Health](https://phpackages.com/badges/elgigi-flysystem-useful-adapters/health.svg)](https://phpackages.com/packages/elgigi-flysystem-useful-adapters)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

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

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.5M85](/packages/unisharp-laravel-filemanager)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[filegator/filegator

Filegator

3.0k1.1k](/packages/filegator-filegator)[azure-oss/storage-blob-flysystem

Flysystem adapter for Azure Storage PHP

281.4M24](/packages/azure-oss-storage-blob-flysystem)[yii2-starter-kit/yii2-file-kit

Yii2 file upload and storage kit

151227.3k6](/packages/yii2-starter-kit-yii2-file-kit)

PHPackages © 2026

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