Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Flysystem Vfs

Flysystem Vfs Laravel Package

league/flysystem-vfs

Flysystem adapter for the PHP VFS library that lets you mount and use a virtual filesystem with Flysystem. Install via Composer and pass a VfsAdapter to a new Filesystem instance.

View on GitHub
Deep Wiki
Context7

Flysystem VFS Adapter

Frequently asked questions about Flysystem Vfs
Does league/flysystem-vfs work with Laravel 11 or Laravel 10?
No. Modern Laravel releases ship Flysystem 3.x, whose adapter contract is FilesystemAdapter with methods such as write, read, listContents, and move. league/flysystem-vfs was written against Flysystem 1.x's AdapterInterface and Composer will also likely refuse to co-install it with league/flysystem ^2 or ^3. It only fits a legacy Laravel 5.x application still pinned to Flysystem 1.x.
How do I install league/flysystem-vfs?
Run composer require league/flysystem-vfs. In a modern Laravel app Composer will almost certainly refuse due to a Flysystem version conflict, because the package targets Flysystem 1.x only. If you have a legacy Flysystem 1.x stack, the require succeeds and you instantiate new Filesystem(new VfsAdapter(new Vfs)) directly. Pin an explicit version constraint rather than relying on a floating ^1.0.
Which Flysystem versions does the VFS adapter support?
Only Flysystem 1.x. It implements the old AdapterInterface from that release line and does not implement the FilesystemAdapter contract introduced with Flysystem 2 and 3. That means there is no out-of-box support for Laravel 9, 10, or 11.
What is the difference between league/flysystem-vfs and league/flysystem-memory?
league/flysystem-memory is a maintained in-memory adapter aligned with current Flysystem interfaces. league/flysystem-vfs is a thin bridge to michael-donat/php-vfs, an in-memory filesystem exposed through the vfs:// stream wrapper, and it is abandoned. For nearly all in-memory use cases, flysystem-memory or Storage::fake() is the better fit; VFS only matters if you specifically need the vfs:// stream wrapper namespace.
How do I register a vfs disk in Laravel with Storage::extend?
In a legacy Laravel 5.x app with Flysystem 1.x, call Storage::extend('vfs', function ($app, $config) { return new Filesystem(new VfsAdapter(new Vfs)); }) inside a service provider. The driver name then works with Storage::disk('vfs'). Do not attempt this on Laravel 9 or later without porting the adapter, because the disk contract expects Flysystem 3 interfaces.
Is league/flysystem-vfs safe to use in production?
Generally no. Its last release was 2016-07-10, the repository has effectively no maintainer activity or real-world usage, and its upstream php-vfs dependency is also dormant. The virtual filesystem lives in process memory, so it is not a persistence or large-file mechanism, and visibility, MIME type, and last-modified behavior are approximate compared with local or S3 disks. That creates green-in-CI, broken-in-production surprises.
Is league/flysystem-vfs still maintained?
No. Its last tagged release was 2016-07-10 and there has been no upstream maintainer activity since. It has zero dependents and around 19 stars, so it is essentially unexercised in the wild. Treat it as abandoned and fork or vendor it if a legacy application truly depends on it.
What should I use instead of league/flysystem-vfs for in-memory files in Laravel tests?
Use Laravel's built-in Storage::fake('disk'), which swaps in a FakeFilesystemAdapter, or wire league/flysystem-memory to a custom disk. For sandboxed plugin I/O, a namespaced directory on the local driver with an explicit cleanup step is usually safer. These options are maintained, compatible with Flysystem 3, and avoid global vfs:// stream wrapper state.
Why does vfs:// state leak between my PHPUnit tests?
PHP stream wrappers register process-wide, and the virtual filesystem persists in memory for the life of the process. If a wrapper is registered or files are left behind, later tests can see stale contents or conflicts, producing hard-to-diagnose pollution. You need explicit teardown that clears the VFS and unregisters the wrapper, which is one reason Storage::fake() is preferable.
How hard is it to port league/flysystem-vfs to Flysystem 3?
It is a small but real rewrite, not a configuration tweak. You need a class implementing FilesystemAdapter with write, writeStream, read, readStream, listContents, move, copy, fileExists, directoryExists, lastModified, mimeType, fileSize, visibility, and setVisibility, delegating to php-vfs. You also need test coverage for the semantics that VFS approximates, and you should verify php-vfs itself works on your target PHP 8.x version. Expect to maintain that fork yourself.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels