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.
League Flysystem V2 doesn't work with Lumen v8.x so use this
composer require "league/flysystem: ~1.0"