PHPackages                             biller/yii2-flysystem - 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. biller/yii2-flysystem

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

biller/yii2-flysystem
=====================

The flysystem 3.0 extension for the Yii framework

4.1.0(1y ago)1271.5k↓22.7%2BSD-3-ClausePHPPHP ^8.1

Since Feb 9Pushed 1y agoCompare

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

READMEChangelog (4)Dependencies (4)Versions (26)Used By (0)

Flysystem (3.0) Extension for Yii 2
===================================

[](#flysystem-30-extension-for-yii-2)

Notice: Only adapts AWS S3, InMemory and local filesystems.
-----------------------------------------------------------

[](#notice-only-adapts-aws-s3-inmemory-and-local-filesystems)

Based on:

This extension provides [Flysystem 3.0](http://flysystem.thephpleague.com/) integration for the Yii framework. [Flysystem](http://flysystem.thephpleague.com/) is a filesystem abstraction which allows you to easily swap out a local filesystem for a remote one.

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

[](#installation)

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

Either run

```
$ composer require biller/yii2-flysystem:^3.0
```

or add

```
"biller/yii2-flysystem": "^3.0"

```

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

Configuring
-----------

[](#configuring)

### Local filesystem

[](#local-filesystem)

Configure application `components` as follows

```
return [
    //...
    'components' => [
        //...
        'fs' => [
            'class' => 'biller\flysystem\LocalFilesystem',
            'path' => '@webroot/files',
        ],
    ],
];
```

### AWS S3 filesystem

[](#aws-s3-filesystem)

Either run

```
$ composer require league/flysystem-aws-s3-V3:^3.15
```

or add

```
"league/flysystem-aws-s3-V3": "^3.15"

```

to the `require` section of your `composer.json` file and configure application `components` as follows

```
return [
    //...
    'components' => [
        //...
        'awss3Fs' => [
            'class' => 'biller\flysystem\AwsS3Filesystem',
            'key' => 'your-key',
            'secret' => 'your-secret',
            'bucket' => 'your-bucket',
            'region' => 'your-region',
            // 'version' => 'latest',
            // 'baseUrl' => 'your-base-url',
            // 'prefix' => 'your-prefix',
            // 'options' => [],
            // 'endpoint' => 'http://my-custom-url'
        ],
    ],
];
```

### Global visibility settings

[](#global-visibility-settings)

Configure `fsID` application component as follows

```
return [
    //...
    'components' => [
        //...
        'fsID' => [
            //...
            'config' => [
                'visibility' => \League\Flysystem\Visibility::PRIVATE,
            ],
        ],
    ],
];
```

Usage
-----

[](#usage)

### Writing or updating files

[](#writing-or-updating-files)

To write or update file

```
Yii::$app->fs->write('filename.ext', 'contents');
```

To write or update file using stream contents

```
$stream = fopen('/path/to/somefile.ext', 'r+');
Yii::$app->fs->writeStream('filename.ext', $stream);
```

### Reading files

[](#reading-files)

To read file

```
$contents = Yii::$app->fs->read('filename.ext');
```

To retrieve a read-stream

```
$stream = Yii::$app->fs->readStream('filename.ext');
$contents = stream_get_contents($stream);
fclose($stream);
```

### Checking if a file exists

[](#checking-if-a-file-exists)

To check if a file exists

```
$exists = Yii::$app->fs->fileExists('filename.ext');
```

### Deleting files

[](#deleting-files)

To delete file

```
Yii::$app->fs->delete('filename.ext');
```

### Getting files mimetype

[](#getting-files-mimetype)

To get file mimetype

```
$mimetype = Yii::$app->fs->mimeType('filename.ext');
```

### Getting files timestamp

[](#getting-files-timestamp)

To get file timestamp

```
$timestamp = Yii::$app->fs->lastModified('filename.ext');
```

### Getting files size

[](#getting-files-size)

To get file size

```
$timestamp = Yii::$app->fs->fileSize('filename.ext');
```

### Creating directories

[](#creating-directories)

To create directory

```
Yii::$app->fs->createDirectory('path/to/directory');
```

Directories are also made implicitly when writing to a deeper path

```
Yii::$app->fs->write('path/to/filename.ext');
```

### Deleting directories

[](#deleting-directories)

To delete directory

```
Yii::$app->fs->deleteDirectory('path/to/filename.ext');
```

### Managing visibility

[](#managing-visibility)

Visibility is the abstraction of file permissions across multiple platforms. Visibility can be either public or private.

```
use League\Flysystem\AdapterInterface;

Yii::$app->fs->write('filename.ext', 'contents', [
    'visibility' => \League\Flysystem\Visibility.PRIVATE
]);
```

You can also change and check visibility of existing files

```
use League\Flysystem\AdapterInterface;

if (Yii::$app->fs->visibility('filename.ext') === \League\Flysystem\Visibility::PRIVATE) {
    Yii::$app->fs->setVisibility('filename.ext', \League\Flysystem\Visibility.PUBLIC);
}
```

### Listing contents

[](#listing-contents)

To list contents

```
$contents = Yii::$app->fs->listContents();

foreach ($contents as $object) {
    echo $object['basename']
        . ' is located at' . $object['path']
        . ' and is a ' . $object['type'];
}
```

By default Flysystem lists the top directory non-recursively. You can supply a directory name and recursive boolean to get more precise results

```
$contents = Yii::$app->fs->listContents('path/to/directory', true);
```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 75.9% 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 ~148 days

Recently: every ~110 days

Total

24

Last Release

711d ago

Major Versions

0.10.0 → 1.0.02020-09-17

1.1.0 → 2.02022-03-08

2.0 → 3.02023-03-23

3.0.1 → 4.0.02024-05-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d6b24a30203ffe182450a393ca15df6c49139a5d31a948126c7833aac2cd431?d=identicon)[juanisorondo](/maintainers/juanisorondo)

---

Top Contributors

[![creocoder](https://avatars.githubusercontent.com/u/896494?v=4)](https://github.com/creocoder "creocoder (151 commits)")[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (18 commits)")[![tachirodriguez](https://avatars.githubusercontent.com/u/25849492?v=4)](https://github.com/tachirodriguez "tachirodriguez (16 commits)")[![mikk150](https://avatars.githubusercontent.com/u/4953629?v=4)](https://github.com/mikk150 "mikk150 (3 commits)")[![pgaultier](https://avatars.githubusercontent.com/u/545714?v=4)](https://github.com/pgaultier "pgaultier (2 commits)")[![kesselb](https://avatars.githubusercontent.com/u/3902676?v=4)](https://github.com/kesselb "kesselb (2 commits)")[![juanisorondo](https://avatars.githubusercontent.com/u/9666184?v=4)](https://github.com/juanisorondo "juanisorondo (2 commits)")[![TonisOrmisson](https://avatars.githubusercontent.com/u/6357451?v=4)](https://github.com/TonisOrmisson "TonisOrmisson (1 commits)")[![dizews](https://avatars.githubusercontent.com/u/452641?v=4)](https://github.com/dizews "dizews (1 commits)")[![handcode](https://avatars.githubusercontent.com/u/825574?v=4)](https://github.com/handcode "handcode (1 commits)")[![huiyang](https://avatars.githubusercontent.com/u/517651?v=4)](https://github.com/huiyang "huiyang (1 commits)")[![k-timoshenko](https://avatars.githubusercontent.com/u/3259675?v=4)](https://github.com/k-timoshenko "k-timoshenko (1 commits)")

---

Tags

filesystemFlysystems3awsfilesyii2

### Embed Badge

![Health badge](/badges/biller-yii2-flysystem/health.svg)

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

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

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

The flysystem extension for the Yii framework

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

AsyncAws S3 filesystem adapter for Flysystem.

2610.5M31](/packages/league-flysystem-async-aws-s3)[craftcms/aws-s3

Amazon S3 integration for Craft CMS

631.5M26](/packages/craftcms-aws-s3)

PHPackages © 2026

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