- Does league/flysystem-bundle work with Laravel?
- No. It is a Symfony bundle that registers Flysystem storages as container services through Symfony's dependency-injection extension and Flex recipes, and Laravel has no equivalent kernel hook for bundle registration. Laravel already ships its own Flysystem integration via Illuminate\Filesystem\FilesystemManager, the Storage facade and config/filesystems.php. Use Laravel's native disks and pull in individual adapter packages only when you need a backend Laravel does not cover.
- How do I install league/flysystem-bundle?
- Install it with Composer through Symfony Flex: composer require league/flysystem-bundle. Flex creates config/packages/flysystem.yaml with a default local storage pointing at %kernel.project_dir%/var/storage/default. You then add entries under the flysystem.storages key, and each one is registered as a service you can inject.
- Which PHP and Symfony versions does flysystem-bundle 3.x require?
- Version 3.x requires PHP 8.2 or newer and Symfony 6.0 or newer, and it works only with Flysystem 3.x. If you are on an older PHP or Symfony release, bundle 2.x still supports Flysystem 3 on earlier versions, and 1.x covers Flysystem 1. Pin league/flysystem explicitly so the bundle and your other libraries agree on the same major version.
- How do I inject a storage into a Symfony service with flysystem-bundle?
- Type-hint League\Flysystem\FilesystemOperator in your constructor or controller argument and use the #[Target] attribute to select the storage by name, or inject the named service directly, for example default.storage. Every storage defined under flysystem.storages is registered as a service and given an alias matching its name. Autowiring with #[Target] is the recommended approach once you have more than one storage.
- Can flysystem-bundle switch storage backends per environment?
- Yes, that is its main selling point. You define named storages in YAML with a local, cloud or in-memory adapter and vary the configuration per environment, so development uses local files, production uses cloud storage and tests use the in-memory adapter. Because application code depends only on FilesystemOperator, nothing in your services changes when the backend does.
- Should Laravel developers use flysystem-bundle instead of the Storage facade?
- No. Laravel's Storage facade and config/filesystems.php already give you named disks, environment-driven configuration through .env, and a FilesystemAdapter that accepts any League\Flysystem\FilesystemAdapter. Adding the Symfony bundle would drag symfony/http-kernel and a bundle lifecycle into a framework that has no hook for it. Treat the bundle as a reference for structuring storage configuration, not as a dependency.
- How do I use a Flysystem adapter Laravel does not support, such as WebDAV or GridFS?
- Install the adapter package on its own, for example league/flysystem-webdav, league/flysystem-bunnycdn or league/flysystem-gridfs, then register a custom disk driver that builds the adapter and passes it to Laravel's FilesystemAdapter. That is typically under a hundred lines of code per adapter. You do not need flysystem-bundle for this, since the adapter packages are plain libraries.
- Is league/flysystem-bundle production ready and actively maintained?
- It is MIT licensed, maintained by the PHP League, and carries an explicit Symfony backward-compatibility promise with a documented upgrade path from Flysystem 1 to 2 to 3. Adoption is modest at roughly 400 GitHub stars, so verify current download counts on Packagist and check the real tag history before relying on it. The underlying Flysystem 3 library is widely used and is the same one Laravel vendors.
- What are the alternatives to flysystem-bundle for filesystem abstraction?
- On Symfony the bundle is effectively the standard, with hand-wiring Flysystem adapters into services as the alternative. On Laravel the alternatives are the native Storage facade and disks, a small internal package that adds custom disk drivers, or using league/flysystem directly with your own container bindings. All of these sit on the same FilesystemOperator contract, so code that depends on the interface stays portable.
- Can a Symfony app and a Laravel app share the same Flysystem storage?
- Yes, because both ultimately use Flysystem 3 adapters, but you must align the configuration explicitly. Use identical storage names, bucket, path prefix and visibility defaults on both sides, and pin league/flysystem to a compatible major in each project. Sharing keys such as uploads.storage avoids surprises when one app reads files written by the other.