fix: register minio custom driver using flysystem-aws-s3-v3 (Laravel 5.0 hardcodes v2)
All checks were successful
Deploy Production (crewsportswear.com) / deploy (push) Successful in 2m5s

This commit is contained in:
Frank John Begornia
2026-04-17 13:03:37 +08:00
parent c6518e81c9
commit 0fe2e2bae6
2 changed files with 18 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ use Illuminate\Support\ServiceProvider;
use Storage;
use League\Flysystem\Filesystem;
use League\Flysystem\Sftp\SftpAdapter;
use League\Flysystem\AwsS3v3\AwsS3Adapter as AwsS3v3Adapter;
use Aws\S3\S3Client;
class AppServiceProvider extends ServiceProvider {
@@ -27,6 +29,21 @@ class AppServiceProvider extends ServiceProvider {
Storage::extend('sftp', function ($app, $config) {
return new Filesystem(new SftpAdapter($config));
});
Storage::extend('minio', function ($app, $config) {
$client = new S3Client([
'credentials' => [
'key' => $config['key'],
'secret' => $config['secret'],
],
'region' => $config['region'],
'version' => 'latest',
'endpoint' => $config['endpoint'],
'use_path_style_endpoint' => filter_var($config['use_path_style_endpoint'] ?? true, FILTER_VALIDATE_BOOLEAN),
]);
$adapter = new AwsS3v3Adapter($client, $config['bucket']);
return new Filesystem($adapter);
});
}
/**