dkarlovi / flysystem-stream-wrapper

A stream wrapper for Flysystem V2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flysystem Stream Wrapper

Author Software License


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

Flysystem V1

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.

Installation

composer require m2mtech/flysystem-stream-wrapper

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');

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,
]);

Testing

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

Changelog

Please see CHANGELOG for more information about recentl changes.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

A stream wrapper for Flysystem V2.

License:MIT License


Languages

Language:PHP 99.4%Language:Dockerfile 0.4%Language:Shell 0.2%