fisharebest / flysystem-chroot-adapter
Creates a filesystem from a sub-folder in another filesystem.
Installs: 34 788
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- league/flysystem: ~3.0
Requires (Dev)
README
This adapter creates a new filesystem from a sub-folder of an existing filesystem.
IMPORTANT: Since flysystem 3.3, this functionality is now available from flysystem directly. You should migrate to that package.
In composer.json, replace fisharebest/flysystem-chroot-adapter
with league/flysystem-path-prefixing
.
In your code, replace Fisharebest\Flysystem\Adapter\ChrootAdapter
with League\Flysystem\PathPrefixing
.
Installation
composer require fisharebest/flysystem-chroot-adapter
Usage
use League\Flysystem\Filesystem; use League\Flysystem\Adapter\Local; use Fisharebest\Flysystem\Adapter\ChrootAdapter // Write a file to a filesystem. $filesystem = new Filesystem(new Local(__DIR__)); $filesystem->write('foo/bar/fab/file.txt', 'hello world!'); // Create a chroot filesystem from the foo/bar folder. $chroot = new Filesystem(new ChrootAdapter($filesystem, 'foo/bar')); // And read it back from the chroot. $chroot->read('fab/file.txt'); // 'hello world!'