@05Eric Well Illuminate\Filesystem\FilesystemManager uses v2 so I wouldn't have thought v3 would work as it's under the AwsS3v3 namespace.
use League\Flysystem\AwsS3v2\AwsS3Adapter as S3Adapter;
Before using the S3 or Rackspace drivers, you will need to install the appropriate package via Composer:
Amazon S3: league/flysystem-aws-s3-v2 ~1.0
I would start with the most basic test which should locally make a file storage/app/file.txt with the string Contents inside.
\Storage::disk('local')->put('file.txt', 'Contents');
Once that works to use s3 the steps are require the flysystem aws v2 package.
composer require league/flysystem-aws-s3-v2
Update config/filesystems.php with your details
's3' => [
'driver' => 's3',
'key' => 'your-key',
'secret' => 'your-secret',
'region' => 'your-region',
'bucket' => 'your-bucket',
],
The swap local for s3 and see you should get the file save on s3
\Storage::disk('s3')->put('file.txt', 'Contents');
That's it really.
What you have actually uncovered is a slight bug in the flysystem-aws-s3-v3 code where it should really be checking if getResponse() is not null before testing the status code on this line.
if ($exception->getResponse()->getStatusCode() === 404) {
https://github.com/thephpleague/flysystem-aws-s3-v3/blob/master/src/AwsS3Adapter.php
public function getMetadata($path)
{
$command = $this->s3Client->getCommand('headObject', [
'Bucket' => $this->bucket,
'Key' => $this->applyPathPrefix($path),
]);
/** @var Result $result */
try {
$result = $this->s3Client->execute($command);
} catch (S3Exception $exception) {
if ($exception->getResponse()->getStatusCode() === 404) {
return false;
}
throw $exception;
}
return $this->normalizeResponse($result->toArray(), $path);
}