StorageVendorAws

Reference for the StorageVendorAws module: it registers AWS S3 as a storage vendor with the storage layer and provides the save, load and delete operations that write, read and remove an object payload in an S3 bucket, keyed by module name, bucket name and file id.

This page is a pure reference. For how the framework fits together, see the Guide.

Classes

StorageVendorAwsService

Registers AWS S3 as a storage vendor with the storage layer and provides its save, load and delete operations. The object key is built from the module name, bucket name and file id, in the form {moduleName}/{bucketName}/{fileId}.{extension}. Credentials come from Config values or, when none are provided, from the AWS SDK default credential chain. Functions are listed alphabetically.

Functions

Delete

StorageVendorAwsService::Delete(string $moduleName, string $bucketName, int $fileId, string $extension): void

Delete the object identified by the module name, bucket name, file id and extension from its S3 bucket.

NameTypeDescription
$moduleNamestringThe module the object belongs to; the first key segment.
$bucketNamestringThe logical bucket name; the S3 bucket and the second key segment.
$fileIdintThe file id, zero-padded into the object key.
$extensionstringThe file extension; appended to the key, or omitted when empty.

Returns void

Load

StorageVendorAwsService::Load(string $moduleName, string $bucketName, int $fileId, string $extension): string

Read the object identified by the module name, bucket name, file id and extension from its S3 bucket and return its contents. Returns an empty string when the object has no body.

NameTypeDescription
$moduleNamestringThe module the object belongs to; the first key segment.
$bucketNamestringThe logical bucket name; the S3 bucket and the second key segment.
$fileIdintThe file id, zero-padded into the object key.
$extensionstringThe file extension; appended to the key, or omitted when empty.

Returns string The object contents, or an empty string when the object has no body.

Save

StorageVendorAwsService::Save(string $moduleName, string $bucketName, int $fileId, string $data, string $mimeType, string $extension): void

Write an object payload to its S3 bucket under the key built from the module name, bucket name, file id and extension. Falls back to the application/octet-stream content type when no mime type is given.

NameTypeDescription
$moduleNamestringThe module the object belongs to; the first key segment.
$bucketNamestringThe logical bucket name; the S3 bucket and the second key segment.
$fileIdintThe file id, zero-padded into the object key.
$datastringThe object payload written as the object body.
$mimeTypestringThe content type; application/octet-stream is used when empty.
$extensionstringThe file extension; appended to the key, or omitted when empty.

Returns void