2

I need to use azure blob storage but the problem is i cann't find any reference or tutorial to apply azure blob storage in Lumen.

I only find azure blob in laravel. Here what i found,

https://matthewdaly.co.uk/blog/2016/10/24/creating-an-azure-storage-adapter-for-laravel/

I don't know how to put the code to config/filesystem.php, i cann't find it in Lumen Framework.

Would you like to give me some reference? Any help would appreciate.

thanks

Josh Parinussa
  • 633
  • 2
  • 11
  • 28

1 Answers1

1

Based on my research, By default lumen doesn't support laravel file system. In order to integrate to lumen,you could 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 in document_root/bootstrap/app.php by adding this code lines:

    $app->singleton('filesystem', function ($app) { return $app->loadComponent('filesystems', 'Illuminate\Filesystem\FilesystemServiceProvider', 'filesystem'); });

Then you could be able to access filesystem by calling app('filesystem') and use it as using in Laravel.

Please refer to another case: https://github.com/laravel/lumen-framework/issues/168

Try to simulate this github source code to add disk configuration:

 'azure' => [
            'driver'    => 'azure',
            'name'      => env('AZURE_STORAGE_NAME'),
            'key'       => env('AZURE_STORAGE_KEY'),
            'container' => env('AZURE_STORAGE_CONTAINER'),
 ],

In addition, i found a package named league/flysystem-azure-blob-storage,you could try it to replace league/flysystem

Jay Gong
  • 23,163
  • 2
  • 27
  • 32