Aller au contenu

omnidrive/s3 Référence de l’API

Étage
Fournisseur · Omnidrive
Version
1.x
Suite de conformité
branchée, CI rouge
Vérifié en réel
Vérifié en partie
Licence
MIT
composer require omnidrive/s3:1.x-dev

Lue dans les fichiers PHP du paquet au commit adad1b569a8c : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.

Omnidrive\S3

  • S3Adapter class

    Flysystem's AsyncAws adapter, with a file's existence asked by HeadObject: 200 is there, 404 is not, any other answer (403: wrong keys, no permission) a failure. The adapter's objectExists() waiter read a 403 as "not there", so a refused request looked like a missing file. AWS answers 404 for a missing object only to a caller with s3:ListBucket, 403 to one without: grant it.

    2 methods

  • S3DriveFactory class

    An S3 bucket - AWS, or any service that speaks S3: MinIO, Scaleway, OVHcloud, Cloudflare R2, Garage... - through league/flysystem-async-aws-s3:

    4 options · 1 method

Omnidrive\S3

S3Adapter class

final class S3Adapter extends AsyncAwsS3Adapter S3Adapter.php:20

Flysystem's AsyncAws adapter, with a file's existence asked by HeadObject: 200 is there, 404 is not, any other answer (403: wrong keys, no permission) a failure. The adapter's objectExists() waiter read a 403 as "not there", so a refused request looked like a missing file. AWS answers 404 for a missing object only to a caller with s3:ListBucket, 403 to one without: grant it.

S3Adapter::__construct()

public function __construct(readonly S3Client $s3, readonly string $s3Bucket, string $prefix = '', ?VisibilityConverter $visibility = null)

S3Adapter::fileExists()

public function fileExists(string $path): bool

S3DriveFactory class

final class S3DriveFactory extends FlysystemDriveFactory S3DriveFactory.php:29

An S3 bucket - AWS, or any service that speaks S3: MinIO, Scaleway, OVHcloud, Cloudflare R2, Garage... - through league/flysystem-async-aws-s3:

(new S3DriveFactory())->create(['bucket' => 'uploads', 'region' => 'eu-west-3', 'key' => '...', 'secret' => '...']); (new S3DriveFactory())->create(['bucket' => 'uploads', 'endpoint' => 'http://minio:9000', 'path_style' => true, 'key' => '...', 'secret' => '...']);

Options: bucket (required), region (us-east-1), endpoint (another service than AWS), path_style (the bucket in the path, not in the host: MinIO), key and secret (else AsyncAws's own chain: environment, ~/.aws, the instance's role), session_token, prefix (every path under it), public_url (else the bucket's own address), visibility (the ACL a file is written with: "public" is public-read, "private" - Flysystem's default), directory_visibility.

The HTTP client is the application's when one is given, else AsyncAws's own.

Options

OptionDefault
region'us-east-1'
path_stylefalse
prefix''
bucketrequired

S3DriveFactory::__construct()

public function __construct(readonly ?HttpClientInterface $http = null)