twistor / flysystem-memory-adapter
An in-memory adapter for Flysystem. Useful for tests.
Installs: 1 065
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- league/flysystem: ~1.0
Requires (Dev)
- phpunit/phpunit: ~4.1
This package is auto-updated.
Last update: 2022-02-01 12:47:56 UTC
README
This adapter keeps a filesystem in memory. It should be useful for tests, allowing you to have a working filesystem without having to clean up after each test run.
Installation
composer require twistor/flysystem-memory-adapter
Usage
use League\Flysystem\Filesystem; use Twistor\Flysystem\MemoryAdapter; $filesystem = new Filesystem(new MemoryAdapter()); $filesystem->write('new_file.txt', 'yay a new text file!'); $contents = $filesystem->read('new_file.txt'); // If you have existing test files, you can populate the memory adapter from a // filesystem path. $adapter = MemoryAdapter::createFromPath('path/to/some/folder'); // Or, you can use an existing filesystem, and convert it. $adapter = MemoryAdapter::createFromFilesystem($filesystem);