You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
Thank you very much for this little snipped. It helped me a lot!
Just wanted to add an update, for everyone else using Laravel 9, as it now uses Flysystem 3.x by default, resulting in some changes. The callback should now return a FilesystemAdapter directly https://laravel.com/docs/9.x/upgrade#flysystem-3.
use League\Flysystem\Filesystem;
use Illuminate\Filesystem\FilesystemAdapter;
use League\Flysystem\AwsS3V3\AwsS3V3Adapter;
Storage::extend('s3', function ($app, $config) {
$adapter = new AwsS3V3Adapter(new S3Client([
'credentials' => [
'key' => $config['key'],
'secret' => $config['secret'],
],
'region' => $config['region'],
'version' => $config['version'],
'endpoint' => $config['url'],
]), $config['bucket']);
return new FilesystemAdapter(new Filesystem($adapter, $config), $adapter, $config);
});
Hello!
Thank you very much for this little snipped. It helped me a lot!
Just wanted to add an update, for everyone else using Laravel 9, as it now uses Flysystem 3.x by default, resulting in some changes. The callback should now return a FilesystemAdapter directly https://laravel.com/docs/9.x/upgrade#flysystem-3.