Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lumen 8.x filesystem not working. Error: Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found

I have installed these two packages

"league/flysystem": "^2.0",
"league/flysystem-aws-s3-v3": "^2.0"

Added these codes in app/bootstrap.php file

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

  $app->register(Illuminate\Filesystem\FilesystemServiceProvider::class);

Also registered the config file filesystems.php

$app->configure('filesystems');

spaces config in filesystems.php

'spaces' => [
  'driver' => 's3',
  'key' => env('DO_SPACES_KEY'),
  'secret' => env('DO_SPACES_SECRET'),
  'endpoint' => env('DO_SPACES_ENDPOINT'),
  'region' => env('DO_SPACES_REGION'),
  'bucket' => env('DO_SPACES_BUCKET'),
 ]

I want to read a file from the storage

$file = Storage::disk('spaces')->get($existing_path);

Now I am getting this error

enter image description here

like image 859
Shakil Anwar Avatar asked Nov 20 '25 04:11

Shakil Anwar


1 Answers

from this answer: removed both "aws/aws-sdk-php": "3.0", and "league/flysystem-aws-s3-v3": "~1.0", "league/flysystem-cached-adapter": "1.0", from composer.json

and run composer require league/flysystem-aws-s3-v3

like image 127
Eden Moshe Avatar answered Nov 21 '25 18:11

Eden Moshe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!