PHPackages                             bayfrontmedia/multi-filesystem - 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. bayfrontmedia/multi-filesystem

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

bayfrontmedia/multi-filesystem
==============================

An easy-to-use library used to manage multiple Flysystem adapters from a single class.

v1.0.1(1y ago)018MITPHPPHP ^8.0

Since Aug 15Pushed 1y agoCompare

[ Source](https://github.com/bayfrontmedia/multi-filesystem)[ Packagist](https://packagist.org/packages/bayfrontmedia/multi-filesystem)[ Docs](https://github.com/bayfrontmedia/multi-filesystem)[ RSS](/packages/bayfrontmedia-multi-filesystem/feed)WikiDiscussions master Synced 1mo ago

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

Multi-Filesystem
----------------

[](#multi-filesystem)

An easy-to-use library used to manage multiple [Flysystem](https://flysystem.thephpleague.com/) adapters from a single class.

- [License](#license)
- [Author](#author)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)

License
-------

[](#license)

This project is open source and available under the [MIT License](LICENSE).

Author
------

[](#author)

[![Bayfront Media](https://camo.githubusercontent.com/0c0163913b2092e97dbf9684970adaf86f2f25871298d3d28b2dff4bf75b2915/68747470733a2f2f63646e312e6f6e62617966726f6e742e636f6d2f62666d2f6272616e642f62666d2d6c6f676f2e737667)](https://camo.githubusercontent.com/0c0163913b2092e97dbf9684970adaf86f2f25871298d3d28b2dff4bf75b2915/68747470733a2f2f63646e312e6f6e62617966726f6e742e636f6d2f62666d2f6272616e642f62666d2d6c6f676f2e737667)

- [Bayfront Media homepage](https://www.bayfrontmedia.com?utm_source=github&utm_medium=direct)
- [Bayfront Media GitHub](https://github.com/bayfrontmedia)

Requirements
------------

[](#requirements)

- PHP `^8.0` (Tested up to `8.4`)

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

[](#installation)

```
composer require bayfrontmedia/multi-filesystem

```

Usage
-----

[](#usage)

**NOTE:** All exceptions thrown by Multi-Filesystem extend `Bayfront\MultiFilesytstem\Exceptions\MultiFilesystemException`, so you can choose to catch exceptions as narrowly or broadly as you like.

A disk name and a `League\Flysystem\Filesystem` instance must be passed to the constructor, and will automatically be set as the default disk.

To aid in consistency when referencing disks, the `Bayfront\MultiFilesystem\DiskName` class contains constants for each of the supported Flysystem adapters.

**Example:**

```
use Bayfront\MultiFilesystem\Disk;
use Bayfront\MultiFilesystem\DiskName;
use League\Flysystem\Local\LocalFilesystemAdapter;
use League\Flysystem\Filesystem;

$local_adapter = new LocalFilesystemAdapter(__DIR__.'/root/directory/');
$local = new Filesystem($local_adapter);

$disk = new Disk(DiskName::LOCAL, $local);
```

### Public methods

[](#public-methods)

- [getNames](#getnames)
- [getDefaultName](#getdefaultname)
- [add](#add)
- [exists](#exists)
- [get](#get)

---

### getNames

[](#getnames)

**Description:**

Return array of disk names.

**Parameters:**

- (None)

**Returns:**

- (array)

---

### getDefaultName

[](#getdefaultname)

**Description:**

Return name of default disk.

**Parameters:**

- (None)

**Returns:**

- (string)

---

### add

[](#add)

**Description:**

Add a `League\Flysystem\Filesystem` instance as a new disk.

If a disk exists with the same name, it will be overwritten.

**Parameters:**

- `$name` (string): Name of disk
- `$filesystem` (object): `League\Flysystem\Filesystem` object

**Returns:**

- (self)

**Example:**

```
use Aws\S3\S3Client;
use Bayfront\MultiFilesystem\DiskName;
use League\Flysystem\AwsS3V3\AwsS3V3Adapter;
use League\Flysystem\Filesystem;

$s3_client = new S3Client([ // Example connecting to Linode object storage
    'version' => 'latest',
    'region' => 'us-southeast-1',
    'endpoint' => 'https://us-southeast-1.linodeobjects.com',
    'credentials' =>
        [
            'key' => 'LINODE_ACCESS_KEY',
            'secret' => 'LINODE_SECRET_KEY',
        ],
]);

$bucket_name = 'NAME_OF_BUCKET';
$path_prefix = 'path/to/storage'; // No leading slash

$s3_adapter = new AwsS3V3Adapter($s3_client, $bucket_name, $path_prefix);
$s3 = new Filesystem($s3_adapter);

$disk->add(DiskName::AWS_S3, $s3);
```

---

### exists

[](#exists)

**Description:**

Does disk name exist?

**Parameters:**

- `$disk` (string)

**Returns:**

- (bool)

**Example:**

```
if ($disk->exists('local')) {
    // Do something
}

```

---

### get

[](#get)

**Description:**

Returns `League\Flysystem\Filesystem` instance for a given disk.

**Parameters:**

- `$disk = ''` (string): Name of disk to return. If empty string, the default disk will be returned.

**Returns:**

- (object): `League\Flysystem\Filesystem` object

**Throws:**

- `Bayfront\MultiFilesystem\Exceptions\DiskNotFoundException`

**Example:**

```
try {

    $local_disk = $disk->get('local');

} catch (DiskNotFoundException $e) {
    die($e->getMessage());
}

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance40

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

509d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ad62c8d0e69358fd63b16fdaa71d5359231cd0cf660bbc3419071dc705c63a8?d=identicon)[bayfrontmedia](/maintainers/bayfrontmedia)

---

Top Contributors

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

---

Tags

phpfilesystemstoragedisk

### Embed Badge

![Health badge](/badges/bayfrontmedia-multi-filesystem/health.svg)

```
[![Health](https://phpackages.com/badges/bayfrontmedia-multi-filesystem/health.svg)](https://phpackages.com/packages/bayfrontmedia-multi-filesystem)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)

PHPackages © 2026

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