flysystem
flysystem copied to clipboard
Filesystem wrapper for a subfolder
Feature Request
Would be nice to have the ability to wrap an existing FlysystemOperator/Flysystem with a class that will point to a subfolder.
Q | A |
---|---|
New Feature | yes |
BC Break | no |
Scenario / Use-case
I have a use case where my framework (Laravel) provides me a Flysystem object for a Disk and a third party library that expects a Flysystem object.
This works nice, but if I want to have multiple instances of that third party object I need to configure multiple disks in the framework. Instead would be nice if I could just take an existing disk and say "Create a new one that is located in a subfolder X"
Something like:
/** @var FlysystemOperator $flysystem */
$flysystem = Storage::disk('foo')->getDriver();
foreach($instances as $instance) {
$library = new Library($instance, new FlysystemWrapper($flysystem, $instance . '/'));
$library->doSomething();
}