PHPackages                             2amigos/yii2-flysystem-component - 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. 2amigos/yii2-flysystem-component

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

2amigos/yii2-flysystem-component
================================

The League Flysystem integration for Yii Framework

1.0.0(8y ago)2057.3k↓36.1%6[3 issues](https://github.com/2amigos/yii2-flysystem-component/issues)[1 PRs](https://github.com/2amigos/yii2-flysystem-component/pulls)BSD-3-ClausePHP

Since Jul 14Pushed 6y ago5 watchersCompare

[ Source](https://github.com/2amigos/yii2-flysystem-component)[ Packagist](https://packagist.org/packages/2amigos/yii2-flysystem-component)[ Docs](https://github.com/2amigos/yii2-flysystem-component)[ RSS](/packages/2amigos-yii2-flysystem-component/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (18)Versions (4)Used By (0)

Flysystem Component Wrappers for Yii 2
======================================

[](#flysystem-component-wrappers-for-yii-2)

[![Latest Stable Version](https://camo.githubusercontent.com/c3f978cfd52dc6a1d546079d5b307a9312130d4ef861be7d9a4fa0534bff2e11/68747470733a2f2f706f7365722e707567782e6f72672f32616d69676f732f796969322d666c7973797374656d2d636f6d706f6e656e742f76657273696f6e)](https://packagist.org/packages/2amigos/yii2-flysystem-component)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/a8c0d40a267222ff9489a9fa57875e951c1ef1a26768b93b4b4b3b8adb0fb0c3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f32616d69676f732f796969322d666c7973797374656d2d636f6d706f6e656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/2amigos/yii2-flysystem-component)[![Quality Score](https://camo.githubusercontent.com/a80de02d8834d54011205679329072c1639cde9a8bcdc1705289b489bfc727d2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f32616d69676f732f796969322d666c7973797374656d2d636f6d706f6e656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/2amigos/yii2-flysystem-component)[![Total Downloads](https://camo.githubusercontent.com/ee5228e2b85e8157360d53832c67d2e655ce05eb9f70c178798db447887ae176/68747470733a2f2f706f7365722e707567782e6f72672f32616d69676f732f796969322d666c7973797374656d2d636f6d706f6e656e742f646f776e6c6f616473)](https://packagist.org/packages/2amigos/yii2-flysystem-component)

> [Flysystem](http://flysystem.thephpleague.com/) is a file system abstraction which allows you to easily swap out a local filesystem for a remote one.

This component library provides components that expose the [Flysystem](http://flysystem.thephpleague.com/) API to your Yii 2 applications. The following are the currently supported ones:

- [AwsS3FsComponent](#awss3fscomponent): Interacts with Amazon S3 buckets.
- [AzureFsComponent](#azurefscomponent): Interacts with Microsoft Azure.
- [DropboxFsComponent](#dropboxfscomponent): Interacts with Dropbox.
- [FtpFsComponent](#ftpfscomponent): Interacts with an FTP server.
- [GoogleCloudFsComponent](#googlecloudfscomponent): Interacts with Google Cloud Storage.
- [GridFSFsComponent](#gridfsfscomponent): Interacts with GridFS.
- [LocalFsComponent](#localfscomponent): Interacts with your local server storage.
- [MemoryFsComponent](#memoryfscomponent): Interacts with memory. Useful when you don't want anything persisted.
- [NullFsComponent](#nullfscomponent): Used for testing.
- [RackspaceFsComponent](#rackspacefscomponent): Interacts with Rackspace.
- [SftpFsComponent](#sftpfscomponent): Interacts with an Sftp server.
- [WebDAVFsComponent](#webdavfscomponent): Interacts with WebDAV.
- [ZipArchiveFsComponent](#ziparchivefscomponent): Interacts with zip archives.

Install
-------

[](#install)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require 2amigos/yii2-flysystem-component
```

or add

```
"2amigos/yii2-flysystem-component": "^1.0"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

### AwsS3FsComponent

[](#awss3fscomponent)

Install dependency

```
$ composer require league/flysystem-aws-s3-v3
```

Configure on the application `components` section:

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\AwsS3FsComponent',
            'key' => 'your-key',
            'secret' => 'your-secret',
            'bucket' => 'your-bucket',
            'region' => 'your-region',
            // 'version' => 'latest',
            // 'baseUrl' => 'your-base-url',
            // 'prefix' => 'your-prefix',
            // 'options' => [],
        ],
    ],
];
```

When you application run, you will be able to use the component as:

```
Yii::$app->fs->read(....);
```

Check  for all the methods available. Same methods for all adapters.

### AzureFsComponent

[](#azurefscomponent)

First ensure the pear repository is added to your `composer.json` file:

```
"repositories": [
    {
        "type": "pear",
        "url": "http://pear.php.net"
    }
],

```

Then install the latest version of the plugin

```
$ composer require league/flysystem-azure
```

Configure on the application `components` section:

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\AzureFsComponent',
            'accountName' => 'your-account-name',
            'accountKey' => 'your-account-key',
            'container' => 'your-container',
        ],
    ],
];
```

### DropboxFsComponent

[](#dropboxfscomponent)

Install dependency

```
$ composer require spatie/flysystem-dropbox
```

Configure on the application `components` section:

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\DropboxFsComponent',
            'token' => 'your-access-token',
            // 'prefix' => 'your-prefix',
        ],
    ],
];
```

### FtpFsComponent

[](#ftpfscomponent)

Configure application `components` as follows

```
return [
    //...
    'components' => [
        //...
        'ftpFs' => [
            'class' => 'dosamigos\flysystem\FtpFsComponent',
            'host' => 'ftp.example.com',
            // 'port' => 21,
            // 'username' => 'your-username',
            // 'password' => 'your-password',
            // 'ssl' => true,
            // 'timeout' => 60,
            // 'root' => '/path/to/root',
            // 'permPrivate' => 0700,
            // 'permPublic' => 0744,
            // 'passive' => false,
            // 'transferMode' => FTP_TEXT,
        ],
    ],
];
```

### GoogleCloudFsComponent

[](#googlecloudfscomponent)

Install dependency

```
$ composer require cedricziel/flysystem-gcs
```

Configure on the application `components` section:

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\GoogleCloudFsComponent',
            'projectId' => 'your-project-id',
            'bucket' => 'your-bucket',
            // 'prefix' => 'your-prefix',
        ],
    ],
];
```

### GridFSFsComponent

[](#gridfsfscomponent)

Install dependency

```
$ composer require league/flysystem-gridfs
```

Configure on the application `components` section:

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\GridFSFsComponent',
            'server' => 'mongodb://localhost:27017',
            'database' => 'your-database',
        ],
    ],
];
```

### LocalFsComponent

[](#localfscomponent)

Configure application `components` as follows

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\LocalFsComponent',
            'path' => '@webroot/your-writable-folder-to-save-files',
        ],
    ],
];
```

### MemoryFsComponent

[](#memoryfscomponent)

Install dependency

```
$ composer require league/flysystem-memory
```

Configure application `components` as follows

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\MemoryFsComponent',
        ],
    ],
];
```

### NullFsComponent

[](#nullfscomponent)

Configure application `components` as follows

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\NullFsComponent',
        ],
    ],
];
```

### RackspaceFsComponent

[](#rackspacefscomponent)

Install dependency

```
$ composer require league/flysystem-rackspace
```

Configure application `components` as follows

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\RackspaceFsComponent',
            'endpoint' => 'your-endpoint',
            'region' => 'your-region',
            'username' => 'your-username',
            'apiKey' => 'your-api-key',
            'container' => 'your-container',
            // 'prefix' => 'your-prefix',
        ],
    ],
];
```

### SftpFsComponent

[](#sftpfscomponent)

Install dependency

```
$ composer require league/flysystem-sftp
```

Configure application `components` as follows

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\SftpFsComponent',
            'host' => 'sftp.example.com',
            'username' => 'your-username',
            'password' => 'your-password',
            'privateKey' => '/path/to/or/contents/of/privatekey',
            // 'port' => 22,
            // 'timeout' => 60,
            // 'root' => '/path/to/root',
            // 'permPrivate' => 0700,
            // 'permPublic' => 0744,
        ],
    ],
];
```

### WebDAVFsComponent

[](#webdavfscomponent)

Install dependency

```
$ composer require league/flysystem-webdav
```

Configure application `components` as follows

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\WebDAVFsComponent',
            'baseUri' => 'your-base-uri',
            // 'userName' => 'your-user-name',
            // 'password' => 'your-password',
            // 'proxy' => 'your-proxy',
            // 'authType' => \Sabre\DAV\Client::AUTH_BASIC,
            // 'encoding' => \Sabre\DAV\Client::ENCODING_IDENTITY,
            // 'prefix' => 'your-prefix',
        ],
    ],
];
```

### ZipArchiveFsComponent

[](#ziparchivefscomponent)

Install dependency

```
$ composer require league/flysystem-ziparchive
```

Configure application `components` as follows

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'dosamigos\flysystem\ZipArchiveFsComponent',
            'path' => '@webroot/files/archive.zip',
            // 'prefix' => 'your-prefix',
        ],
    ],
];
```

Cool Stuff
----------

[](#cool-stuff)

### Multiple Instances

[](#multiple-instances)

You can configure as many components as you need. Simply add them to the `components` section with different names. For example, I could have S3 and FTP at the same time:

```
return [
    //...
    'components' => [
        //...
        's3Fs' => [
            'class' => 'dosamigos\flysystem\AwsS3FsComponent',
            'key' => 'your-key',
            'secret' => 'your-secret',
            'bucket' => 'your-bucket',
            'region' => 'your-region',
            // 'version' => 'latest',
            // 'baseUrl' => 'your-base-url',
            // 'prefix' => 'your-prefix',
            // 'options' => [],
        ],
        'ftpFs => [
            'class' => 'dosamigos\flysystem\FtpFsComponent',
            'host' => 'ftp.example.com',
        ]
    ],
];
```

Now, I could use them like `Yii::$app->s3Fs` and `Yii::$app->ftpFs` respectively.

### Caching

[](#caching)

If you wish to add caching functionality, first we need to include the dependencies on your `composer.json` file:

```
$ composer require league/flysystem-cached-adapter
```

Next, configure the following attributes on your adapter:

```
return [
 //...
 'components' => [
     //...
     'fs' => [
         //...
         'cache' => 'cacheID',
         // 'cacheKey' => 'my-cache-key',
         // 'cacheDuration' => 7200,
     ],
 ],
];
```

### Replicating

[](#replicating)

The replication facilitates transitions between adapters, allowing an application to stay functional and migrate its files from one adapter to another. The adapter takes two other adapters, a source and a replica. Every change is delegated to both adapters, while all the read operations are passed onto the source only.

To use the replication feature first install its dependencies:

```
$ composer require league/flysystem-replicate-adapter
```

Next, configure as follows:

```
return [
    //...
    'components' => [
        //...
        's3Fs' => [
            'class' => 'dosamigos\flysystem\AwsS3FsComponent',
            'key' => 'your-key',
            'secret' => 'your-secret',
            'bucket' => 'your-bucket',
            'region' => 'your-region',
        ],
        'ftpFs => [
            'class' => 'dosamigos\flysystem\FtpFsComponent',
            'host' => 'ftp.example.com',
            'replica' => 's3Fs' // we have added the ID of the replica component
        ]
    ],
];
```

Further Information
-------------------

[](#further-information)

- [API](API.md)
- [Flysystem](http://flysystem.thephpleague.com/)

Testing
-------

[](#testing)

```
$ phpunit
```

Using code fixer
----------------

[](#using-code-fixer)

We have added a PHP code fixer to standardize our code. It includes Symfony, PSR2 and some contributors rules.

```
./vendor/bin/php-cs-fixer fix ./src --config .php_cs
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [crecoder](https://github.com/creocoder) for the original idea of flysystem wrappers
- [2amigos](https://github.com/2amigos)
- [All Contributors](../../contributors)

License
-------

[](#license)

The BSD License (BSD). Please see [License File](LICENSE.md) for more information.

> [![](https://camo.githubusercontent.com/9fd8f1de41dc23003bb2a54034cb6658dde5be97092e195a62d629d0d7fa7f6c/687474703a2f2f7777772e67726176617461722e636f6d2f6176617461722f35353336333339346437323934356666376564333132353536656330343165302e706e67)](http://www.2amigos.us)
>  *Custom Software | Web &amp; Mobile Software Development*
>  [www.2amigos.us](http://www.2amigos.us)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 58.3% 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

3

Last Release

3230d ago

Major Versions

0.0.2 → 1.0.02017-07-15

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/566016?v=4)[Antonio Ramirez](/maintainers/tonydspaniard)[@tonydspaniard](https://github.com/tonydspaniard)

---

Top Contributors

[![tonydspaniard](https://avatars.githubusercontent.com/u/566016?v=4)](https://github.com/tonydspaniard "tonydspaniard (21 commits)")[![creocoder](https://avatars.githubusercontent.com/u/896494?v=4)](https://github.com/creocoder "creocoder (11 commits)")[![Slayvin](https://avatars.githubusercontent.com/u/4197772?v=4)](https://github.com/Slayvin "Slayvin (2 commits)")[![vova07](https://avatars.githubusercontent.com/u/2714082?v=4)](https://github.com/vova07 "vova07 (2 commits)")

---

Tags

2amigoscomponentflysystemyii2ftpfilesystemFlysystems3awssftpfilesazureWebDAVyii2extensionyiiyii2-extensionyii 2dropboxrackspaceGridFS2amigosyii2-flysystem-component

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/2amigos-yii2-flysystem-component/health.svg)

```
[![Health](https://phpackages.com/badges/2amigos-yii2-flysystem-component/health.svg)](https://phpackages.com/packages/2amigos-yii2-flysystem-component)
```

###  Alternatives

[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[league/flysystem

File storage abstraction for PHP

13.6k639.1M2.2k](/packages/league-flysystem)[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)
