twistor/flysystem-memory-adapter

This package is abandoned and no longer maintained. The author suggests using the league/flysystem-memory package instead.

An in-memory adapter for Flysystem. Useful for tests.

v1.0.0 2015-05-26 23:04 UTC

This package is auto-updated.

Last update: 2022-02-01 12:47:56 UTC


README

Author Build Status Coverage Status Software License Packagist Version

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