Skip to content

Instantly share code, notes, and snippets.

@aasumitro
Forked from deividaspetraitis/lumen-filesystem.md
Created September 2, 2019 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aasumitro/40192123f4eb0eb9ec9c25111932f518 to your computer and use it in GitHub Desktop.
Save aasumitro/40192123f4eb0eb9ec9c25111932f518 to your computer and use it in GitHub Desktop.
Lumen flysystem ( filesystem ) integration

Lumen flysystem integration

By default lumen doesn't support laravel file system. In order to integrate to lumen we need follow these instructions:

  1. composer require league/flysystem
  2. Copy filesystems config file from Laravel ( https://github.com/laravel/laravel/blob/master/config/filesystems.php ) to your local Lumen installation document_root/config
  3. Bind filesystem to IoC for example in document_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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment