PHPackages                             m2mtech/flysystem-stream-wrapper - 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. m2mtech/flysystem-stream-wrapper

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

m2mtech/flysystem-stream-wrapper
================================

A stream wrapper for Flysystem V2 &amp; V3.

v1.4.1(1y ago)19250.2k↓52.3%14[8 PRs](https://github.com/m2mtech/flysystem-stream-wrapper/pulls)4MITPHPPHP ^7.2 || ^8.0CI passing

Since Nov 1Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/m2mtech/flysystem-stream-wrapper)[ Packagist](https://packagist.org/packages/m2mtech/flysystem-stream-wrapper)[ Docs](https://github.com/m2mtech/flysystem-stream-wrapper)[ RSS](/packages/m2mtech-flysystem-stream-wrapper/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (12)Versions (17)Used By (4)

Flysystem Stream Wrapper
========================

[](#flysystem-stream-wrapper)

[![Author](https://camo.githubusercontent.com/f7f4b78e6905bcc447517f1d77b7160678f98c9ad66899a442b7114bb8e09d1f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406d326d746563682d626c75652e7376673f7374796c653d666c61742d737175617265)](http://www.m2m.at)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

---

This package provides a stream wrapper for Flysystem V2 &amp; V3.

Flysystem V1
------------

[](#flysystem-v1)

If you're looking for Flysystem 1.x support, check out the [twistor/flysystem-stream-wrapper](https://github.com/twistor/flysystem-stream-wrapper).

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

[](#installation)

```
composer require m2mtech/flysystem-stream-wrapper
```

Usage
-----

[](#usage)

```
use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter;
use M2MTech\FlysystemStreamWrapper\FlysystemStreamWrapper;

$filesystem = new Filesystem(new LocalFilesystemAdapter('/some/path'));
FlysystemStreamWrapper::register('fly', $filesystem);

file_put_contents('fly://filename.txt', $content);
mkdir('fly://happy_thoughts');

FlysystemStreamWrapper::unregister('fly');
```

The stream wrapper implements [`symfony/lock`](https://symfony.com/doc/current/components/lock.html) due to Flysystem V2 not supporting locking. By default, file locking using `/tmp` is used, but you can adjust this through configuration:

```
FlysystemStreamWrapper::register('fly', $filesystem, [
    FlysystemStreamWrapper::LOCK_STORE => 'flock:///tmp',
    FlysystemStreamWrapper::LOCK_TTL => 300,
]);
```

### Handling Visibility Issues

[](#handling-visibility-issues)

Some adaptors might throw exceptions when dealing with visibility. If you encounter such issues, configure the stream wrapper to bypass them:

```
FlysystemStreamWrapper::register('fly', $filesystem, [
    FlysystemStreamWrapper::IGNORE_VISIBILITY_ERRORS => true,
]);
```

### Addressing Directory Issues (`file_exists` / `is_dir`)

[](#addressing-directory-issues-file_exists--is_dir)

Some adaptors might not return dates for the last modified attribute for directories. In such cases, you can enable emulation to achieve the desired behavior:

```
FlysystemStreamWrapper::register('fly', $filesystem, [
    FlysystemStreamWrapper::EMULATE_DIRECTORY_LAST_MODIFIED => true,
]);
```

### Dealing with `is_readable` / `is_writable`

[](#dealing-with-is_readable--is_writable)

Some filesystem functions depend on the `uid` and `gid` of the user executing PHP. Since a reliable cross-platform method to derive these values isn't available, the wrapper attempts to estimate them. If this fails, set them manually:

```
FlysystemStreamWrapper::register('fly', $filesystem, [
    FlysystemStreamWrapper::UID => 1000,
    FlysystemStreamWrapper::GID => 1000,
]);
```

Alternatively, access the parameters for [`PortableVisibilityConverter`](https://flysystem.thephpleague.com/docs/usage/unix-visibility/) directly:

```
FlysystemStreamWrapper::register('fly', $filesystem, [
    FlysystemStreamWrapper::VISIBILITY_FILE_PUBLIC => 0644,
    FlysystemStreamWrapper::VISIBILITY_FILE_PRIVATE => 0600,
    FlysystemStreamWrapper::VISIBILITY_DIRECTORY_PUBLIC => 0755,
    FlysystemStreamWrapper::VISIBILITY_DIRECTORY_PRIVATE => 0700,
    FlysystemStreamWrapper::VISIBILITY_DEFAULT_FOR_DIRECTORIES => Visibility::PRIVATE,
]);
```

Testing
-------

[](#testing)

This package was developed using PHP 7.4 and has been tested for compatibility with PHP versions 7.2 through 8.3.

To test:

- With PHP installed:

```
composer test
```

- Inside a Docker environment for PHP 7.4:

```
docker compose run php74 composer test
```

**Note**: PHPUnit v10, used from PHP 8.1 onwards, requires a different config file:

```
docker compose run php81 composer test10
```

Changelog
---------

[](#changelog)

For information on recent changes, refer to the [CHANGELOG](CHANGELOG.md).

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

[](#contributing)

For contribution guidelines, see [CONTRIBUTING](.github/CONTRIBUTING.md).

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover any security vulnerabilities, please follow [our security policy](../../security/policy) for reporting.

Credits
-------

[](#credits)

- This package was inspired by [twistor/flysystem-stream-wrapper](https://github.com/twistor/flysystem-stream-wrapper). Many thanks to [Chris Leppanen](https://github.com/twistor).
- [All Contributors](../../contributors)

License
-------

[](#license)

Licensed under the MIT License. See the [License File](LICENSE.md) for more details.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance56

Moderate activity, may be stable

Popularity45

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 78.6% 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 ~105 days

Recently: every ~246 days

Total

13

Last Release

411d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1568448?v=4)[Martin Mandl](/maintainers/m2mtech)[@m2mtech](https://github.com/m2mtech)

---

Top Contributors

[![m2mtech](https://avatars.githubusercontent.com/u/1568448?v=4)](https://github.com/m2mtech "m2mtech (33 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![briceflaceliere](https://avatars.githubusercontent.com/u/5811531?v=4)](https://github.com/briceflaceliere "briceflaceliere (1 commits)")[![danut007ro](https://avatars.githubusercontent.com/u/1083134?v=4)](https://github.com/danut007ro "danut007ro (1 commits)")[![dkarlovi](https://avatars.githubusercontent.com/u/209225?v=4)](https://github.com/dkarlovi "dkarlovi (1 commits)")[![snapshotpl](https://avatars.githubusercontent.com/u/312655?v=4)](https://github.com/snapshotpl "snapshotpl (1 commits)")

---

Tags

filesystemphpstreamwrapperFlysystemstreamwrapperstream-wrapper

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/m2mtech-flysystem-stream-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/m2mtech-flysystem-stream-wrapper/health.svg)](https://phpackages.com/packages/m2mtech-flysystem-stream-wrapper)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.7k277.8M952](/packages/league-flysystem-aws-s3-v3)[league/flysystem-bundle

Symfony bundle integrating Flysystem into Symfony applications

40131.4M117](/packages/league-flysystem-bundle)[barryvdh/elfinder-flysystem-driver

A Flysystem Driver for elFinder

1864.9M40](/packages/barryvdh-elfinder-flysystem-driver)[masbug/flysystem-google-drive-ext

Flysystem adapter for Google Drive with seamless virtual&lt;=&gt;display path translation

2672.0M17](/packages/masbug-flysystem-google-drive-ext)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M506](/packages/shopware-core)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6333.1M132](/packages/league-flysystem-sftp-v3)

PHPackages © 2026

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