This package provides a stream wrapper for Flysystem V2 & V3.
If you're looking for Flysystem 1.x support, check out the twistor/flysystem-stream-wrapper, on which this package is based on.
This project is a complete rewrite and has just the name and the functionality as stream wrapper in common with the V1 package. Please note that there is also a recent pull request for V2 waiting though the last merge seems to be from November 2018. Thus, a new package seemed to be reasonable.
composer require m2mtech/flysystem-stream-wrapper
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');
Because locking is not supported by Flysystem V2, the stream wrapper implements symfony/lock
. As default, it uses file locking using /tmp
, which you can adjust via the configuration:
FlysystemStreamWrapper::register('fly', $filesystem, [
FlysystemStreamWrapper::LOCK_STORE => 'flock:///tmp',
FlysystemStreamWrapper::LOCK_TTL => 300,
]);
This package has been developed for php 7.4 with compatibility tested for php 7.2 to 8.1.
# with php installed
composer test
# or inside docker e.g. for php 7.4
docker-compose run php74 composer test
Please see CHANGELOG for more information about recentl changes.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
- This package is based on [twistor/flysystem-stream-wrapper]. Kudos and thanks to Chris Leppanen.
- All Contributors
The MIT License (MIT). Please see License File for more information.