PHPackages                             phpguus/flysystem-raid - 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. phpguus/flysystem-raid

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

phpguus/flysystem-raid
======================

A flysystem driver for Redundant Array of Independent Disk configurations.

v1.1.2(6y ago)32121MITPHPPHP ^7.2CI failing

Since Sep 15Pushed 6y ago1 watchersCompare

[ Source](https://github.com/PHPGuus/flysystem-raid)[ Packagist](https://packagist.org/packages/phpguus/flysystem-raid)[ RSS](/packages/phpguus-flysystem-raid/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (1)

Flysystem-raid
==============

[](#flysystem-raid)

[![Latest Version on Github](https://camo.githubusercontent.com/1fcd033fe4bb097846ff33e76e79823514b9b6bcfde2470023be3309e029ea6f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f706870677575732f666c7973797374656d2d726169643f7374796c653d666c61742d737175617265)](https://github.com/phpguus/flysystem-raid)[![Latest Version on Packagist](https://camo.githubusercontent.com/ddca92cbec36c79933222b4d53640754ad88f3612581fa6f37816f6af0e908cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706870677575732f666c7973797374656d2d726169643f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phpguus/flysystem-raid)[![Build Status](https://camo.githubusercontent.com/2dca1cdf3a008282e6be8046d9c613bf37f2e4c98c4df082ddee2030f8a7d5be/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f706870677575732f666c7973797374656d2d726169642f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.com/phpguus/flysystem-raid)[![StyleCI](https://camo.githubusercontent.com/2f69e58a9d95513ae5516faae4f6afe4a42b4578180e298e6211031561ae0e8f/68747470733a2f2f7374796c6563692e696f2f7265706f732f3230383538333233352f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/208583235)[![Quality Score](https://camo.githubusercontent.com/0729c5ee1bbce1e1a68aaa91bbbcc2b56b566395ed689409c8c6eec2f57fc8a8/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f706870677575732f666c7973797374656d2d726169642e7376673f7374796c653d666c61742d737175617265)](https://img.shields.io/scrutinizer/quality/g/phpguus/flysystem-raid)[![Total Downloads](https://camo.githubusercontent.com/a697b7b643af39f27a7efbdd7370f503b0fb56c8088c1da306b850dcb61b6d16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706870677575732f666c7973797374656d2d726169642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phpguus/flysystem-raid)

Flysystem-raid provides RAID functionality across multiple flysystem filesystems.

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

[](#installation)

Require the package using composer

```
composer require phpguus/flysystem-raid
```

Usage
-----

[](#usage)

### RAID-0

[](#raid-0)

RAID-0 is commonly known to provide striping of data.

We do not yet provide support for this kind of RAID configuration.

### RAID-1

[](#raid-1)

RAID-1 is commonly known to provide mirroring of data. Because we use the [Flysystem](https://github.com/thephpleague/flysystem) abstraction, we can mirror data across any Flysystem, and make it redundantly available.

This is, in some respects, better than what a CDN can provide. A CDN normally covers only one vendor, for example DigitalOcean's Spaces CDN. This package, however, allows you to create mirrored data across many vendors, including a local disk.

If you want to keep files on your web server as well as in the cloud, this RAID configuration is all you need to do exactly that.

```
use Aws\S3\S3Client;
use League\Flysystem\Adapter\Local;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Config;
use League\Flysystem\Filesystem;
use PHPGuus\FlysystemRaid\RaidOneAdapter;

include __DIR__ . '/vendor/autoload.php';

$s3Client = new S3Client([
    'credentials' => [
        'key'    => 'your-key',
        'secret' => 'your-secret'
    ],
    'region' => 'your-region',
    'version' => 'latest|version',
]);
$this->adapter = new RaidOneAdapter([
    new Filesystem(new Local('/local_files')),
    new Filesystem(new AWSS3Adapter($s3Client, 'your-bucket-name')),
]);

$this->adapter->write('myFirstFile.txt',
    'The quick brown fox jumps over the lazy dog.', new Config());
```

The file `myFirstFile.txt` is now written in both `/local_files` and in the AWS cloud.

#### Extending the mirror to a new location

[](#extending-the-mirror-to-a-new-location)

Extending the mirroring of your RAID-1 configuration to a new location is very simple:

```
$this->adapter = new RaidOneAdapter([
    new Filesystem(new Local('/my_other_local_drive')),
    new Filesystem(new Local('/local_files')),
    new Filesystem(new AWSS3Adapter($s3Client, 'your-bucket-name')),
]);
$this->adapter->rebuildArray();
```

#### Replacing one location of the mirror

[](#replacing-one-location-of-the-mirror)

If you want to replace a location, because for example you change vendors from AWS to Digital Ocean, you need to perform a two step approach:

Step 1 is to make sure that your mirror is fully redundant:

```
$this->adapter = new RaidOneAdapter([
    new Filesystem(new Local('/local_files')),
    new Filesystem(new AWSS3Adapter($s3Client, 'your-bucket-name')),
]);
/* Ensure that both locations have identical data */
$this->adapter->rebuildArray();
```

Step 2 is to replace your AWS adapter configuration with a new one and to rebuild the array:

```
$s3Client = new S3Client([
    'credentials' => [
        'key'    => 'your-digital-ocean-key',
        'secret' => 'your-digital-ocean-secret'
    ],
    'region' => 'your-digital-ocean-region',
    'version' => 'latest|version',
]);
$this->adapter = new RaidOneAdapter([
    new Filesystem(new Local('/my_other_local_drive')),
    new Filesystem(new AWSS3Adapter($s3Client, 'your-digital-ocean-bucket-name')),
]);
$this->adapter->rebuildArray();
```

#### Knowing when to rebuild the array

[](#knowing-when-to-rebuild-the-array)

`$this->adapter->getMetadata($filePath);` returns an array that has a key `mirrors`. The value of this key indicates the number of mirrors that exist for this file. If this is less than the number of locations configured in your adapter, you need to rebuild the array.

It would make sense to run a scheduled script that calls `rebuildArray()` at least once a day.

### RAID-5

[](#raid-5)

RAID-5 is commonly known to sustain the failure of **one** of its configured components through the use of a single parity disk that can be used to calculate missing data. At least 3 disks are necessary to provide RAID-5 protection, two are used for data, and one is used for parity calculations.

In modern implementations, RAID-5 parity data is stored across all three disks, as is the principle data.

We do not yet provide support for this kind of RAID configuration.

### RAID-6

[](#raid-6)

RAID-6, aka Double Parity RAID, is commonly known to sustain the failure of **two** of its configured components through the use of a two parity disks that can be used to calculate missing data. At least 4 disks are necessary to provide RAID-6 protection, two are used for data, and two are used for parity calculations.

In modern implementations, RAID-6 parity data is stored across all 4 disks, as is the principle data.

We do not yet provide support for this kind of RAID configuration.

### RAID-10

[](#raid-10)

This is combination of Striping and Mirroring, in which your data is striped across all disks, and each stripe (generally 8KiB) is mirrored.

We do not yet provide support for this kind of RAID configuration.

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

[MIT](./LICENSE.md)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

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 ~0 days

Total

4

Last Release

2435d ago

PHP version history (3 changes)1.0.0PHP ^7.3.0

1.1.1PHP ^7.1.3

v1.1.2PHP ^7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/36767653?v=4)[PHPGuus](/maintainers/PHPGuus)[@PHPGuus](https://github.com/PHPGuus)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phpguus-flysystem-raid/health.svg)

```
[![Health](https://phpackages.com/badges/phpguus-flysystem-raid/health.svg)](https://phpackages.com/packages/phpguus-flysystem-raid)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/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.3M74](/packages/unisharp-laravel-filemanager)[league/flysystem-local

Local filesystem adapter for Flysystem.

226231.8M39](/packages/league-flysystem-local)[league/flysystem-bundle

Symfony bundle integrating Flysystem into Symfony applications

40029.5M87](/packages/league-flysystem-bundle)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6129.6M91](/packages/league-flysystem-sftp-v3)[league/flysystem-memory

In-memory filesystem adapter for Flysystem.

8533.6M194](/packages/league-flysystem-memory)

PHPackages © 2026

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