Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Laravel cannot find League\Flysystem\AwsS3v3\AwsS3Adapter

ErrorClass 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found

Short answer

The S3 adapter package is missing, or your code names the class from an older Flysystem. Laravel 12 works with Flysystem 3, which needs league/flysystem-aws-s3-v3 at ^3.0, and its adapter is called AwsS3V3Adapter. Install the matching package and update any code that still uses the old name.

  • Applies to Laravel 12, PHP 8.4, league/flysystem-aws-s3-v3 3.x, Composer 2
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    See which Flysystem packages are installed and where the old class name is used.

    composer show 'league/flysystem*'
    grep -rn "AwsS3Adapter" app config
  2. 2Match what you see, then jump to its fix

    1. 1composer show lists no league/flysystem-aws-s3-v3, or lists a 1.x version next to flysystem 3The S3 package is not installed, or is on an old major versionFix
    2. 2grep finds AwsS3Adapter or the AwsS3v3 namespace in your own code or in a package that is out of dateCustom code still names the old adapter classFix

What does the error look like?

  • Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found

Cause 1 of 2

The S3 package is not installed, or is on an old major version

1Check

Laravel's S3 disk needs the Flysystem S3 package. The Flysystem upgrade notes say adapters must be upgraded together with the core package.

composer show league/flysystem-aws-s3-v3

2Fix

Install the package at the version Laravel documents, letting Composer update the packages that depend on it.

composer require league/flysystem-aws-s3-v3 "^3.0" --with-all-dependencies

3Verify

The package shows version 3.x.

composer show league/flysystem-aws-s3-v3

Confirmed by laravel.com

Did this fix it?

Cause 2 of 2

Custom code still names the old adapter class

1Check

The current package documents its adapter as League\Flysystem\AwsS3V3\AwsS3V3Adapter. Use that name in code you control.

grep -rn "AwsS3v3\\\\AwsS3Adapter" app config vendor/*/ --include=*.php -l

2Fix

Change the import and the construction to the current class. For the normal s3 disk in config/filesystems.php, do not build the adapter yourself: let Laravel create it.

use League\Flysystem\AwsS3V3\AwsS3V3Adapter;

3Verify

Clear the cached config and repeat the action that failed.

php artisan config:clear

Confirmed by flysystem.thephpleague.com

Did this fix it?

How do I stop it coming back?

  • Install the S3 package when you enable the s3 disk, using the command from the Laravel docs.
  • Prefer the s3 disk in config/filesystems.php over building adapters by hand.
  • Run composer outdated after a framework upgrade to catch packages that still target the old Flysystem.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

composer require maatwebsite/excel fails to install

Composer says the package needs an older PHP than the one installed

Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.

3 causes, each with a fix

Back end

composer require laravel/horizon fails: ext-pcntl is missing

laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system

Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.