By default lumen doesn't support laravel file system. In order to integrate to lumen we need follow these instructions:
- composer require league/flysystem
- Copy filesystems config file from Laravel ( https://github.com/laravel/laravel/blob/master/config/filesystems.php ) to your local Lumen installation
document_root/config
- Bind
filesystem
to IoC for example indocument_root/bootstrap/app.php
by adding this code lines:
$app->singleton('filesystem', function ($app) { return $app->loadComponent('filesystems', 'Illuminate\Filesystem\FilesystemServiceProvider', 'filesystem'); });
From now you should be able to access filesystem by calling app('filesystem')
and use it as using in Laravel.
Neither in the
filesystems.php
config file nor in any of the code snippets in your instruction do I find any reference to the Flysystem namespace. How does this solution actually ACCOMPLISH binding Flysystem as a filesystem provider/service/driver/adapter/whatever in Lumen?Is it the case that the use of Flysystem is actually (hard)coded into
Illuminate\Filesystem\FilesystemServiceProvider
, but this provider itself isn't brought to life in a Lumen app by default? I've been struggling to understand what EXACTLY the relationship betweenIlluminate\Filesystem
andLeague\Flysystem
is.Or is it the case that edits to the
config/filesystems.php
are necessary beyond just copying it - edits that would have to be done in full Laravel too, and are perhaps documented elsewhere?