rene-roscher/flysystem-aws-s3-v3-minio

Flysystem适配器,用于AWS S3 SDK v3.x,为支持minio而分支。 (Laravel 8 / Php 8)

2.0.1 2021-10-20 12:57 UTC

README

Author Build Status Coverage Status Quality Score Software License Packagist Version Total Downloads

这是aws-sdk-php v3的Flysystem适配器。分支以支持minio。(https://minio.io

安装

composer require coraxster/flysystem-aws-s3-v3-minio

引导

<?php
use Aws\S3\S3Client;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Filesystem;

include __DIR__ . '/vendor/autoload.php';

$client = new S3Client([
    'credentials' => [
        'key'    => 'your-key',
        'secret' => 'your-secret'
    ],
    'region' => 'your-region',
    'version' => 'latest|version',
]);

$options = [
        'override_visibility_on_copy' => true
    ];
$adapter = new AwsS3Adapter($client, 'your-bucket-name', '', $options);
$filesystem = new Filesystem($adapter);

Laravel

config/filesystems.php

'site' => [
    'driver' => 's3',
    'key' => env('AWS_KEY'),
    'secret' => env('AWS_SECRET'),
    'endpoint' => env('AWS_ENDPOINT'),
    'region' => env('AWS_REGION'),
    'bucket' => env('AWS_BUCKET'),
    'use_path_style_endpoint' => true,
    'options' => [
        'override_visibility_on_copy' => 'private',
    ]
]