PHPackages                             elazar/flystream - 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. elazar/flystream

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

elazar/flystream
================

PHP stream wrapper for Flysystem v2 and v3

1.4.0(1y ago)2051.2k↑23.3%51MITPHPPHP ^8.1CI passing

Since Jul 17Pushed 11mo ago2 watchersCompare

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

READMEChangelogDependencies (8)Versions (13)Used By (1)

Flystream
=========

[](#flystream)

[![PHP Version Support](https://camo.githubusercontent.com/cb344141d6a48e32e1f644895452c73788fcdf9cb0d4be703e8d4d731bd81290/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d706870266d6573736167653d2533453d253230382e312e3026636f6c6f723d626c7565)](https://packagist.org/packages/elazar/flystream)[![Packagist Version](https://camo.githubusercontent.com/66ab85704a86583936d4c7d8668af6525327557fc1554c781287d262adc4d82e/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d7061636b6167697374266d6573736167653d312e322e3026636f6c6f723d626c7565)](https://packagist.org/packages/elazar/flystream)[![Software License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Buy Me a Cofee](https://camo.githubusercontent.com/6cc1f89c6279c0e23c3041191d0a1784ab2f91fee6e8485d29c446d8370f54b1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275792532306d6525323061253230636f666665652d646f6e6174652d626c75652e737667)](https://ko-fi.com/elazar)

[Flysystem v2/3](https://flysystem.thephpleague.com/v2/docs/) + [PHP stream wrappers](https://www.php.net/manual/en/class.streamwrapper.php) = 🔥

Flystream enables you to use core PHP filesystem functions to interact with Flysystem filesystems by registering them as custom protocols.

Released under the [MIT License](https://en.wikipedia.org/wiki/MIT_License).

Supported Use Cases
-------------------

[](#supported-use-cases)

- Using Flysystem with another library that interacts with the filesystem using PHP filesystem functions instead of Flysystem.
- Intercepting filesystem operations for verification in tests.
- Improving the speed of tests where the code under test would otherwise require access to the local filesystem.

Unsupported Use Cases
---------------------

[](#unsupported-use-cases)

- Flystream doesn't and won't support Flysystem v1. If you want a similar library for v1, see [twistor/flysystem-stream-wrapper](https://github.com/twistor/flysystem-stream-wrapper).

Known Issues
------------

[](#known-issues)

- If a file or directory handle is not explicitly closed after use (i.e. using [`fclose()`](https://www.php.net/fclose) or [`closedir()`](https://www.php.net/closedir) as appropriate), PHP will implicitly attempt to close it during [shutdown](https://www.php.net/manual/en/function.register-shutdown-function.php). This situation may trigger a segmentation fault in some environments. This issue has [been resolved](https://github.com/elazar/xdebug-date-stream-php-segfault) and is available in PHP 7.4.23, 8.0.10, and 8.1.0. In older versions, the easiest work-around is to ensure that file and directory handles are explicitly closed.

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

[](#requirements)

- PHP 8.1+
- Flysystem 2 or 3

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

[](#installation)

Use [Composer](https://getcomposer.org/).

```
composer require elazar/flystream
```

**Note**: This will automatically install the latest version of the Flysystem core library that is available for your environment. However, you must handle installing adapters yourself. See [the Flysystem documentation](https://flysystem.thephpleague.com/docs/) for a list of official adapters.

Usage
-----

[](#usage)

If you want to run the examples below, you will need to install [`league/flysystem-memory`](https://packagist.org/packages/league/flysystem-memory).

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

These examples below aren't comprehensive, but should provide a basic understanding of the capabilities of Flystream.

```
