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.
StorageVendorAwsService- registers AWS S3 as a storage vendor and saves, loads and deletes object payloads.
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.
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.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module the object belongs to; the first key segment. |
$bucketName | string | The logical bucket name; the S3 bucket and the second key segment. |
$fileId | int | The file id, zero-padded into the object key. |
$extension | string | The 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.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module the object belongs to; the first key segment. |
$bucketName | string | The logical bucket name; the S3 bucket and the second key segment. |
$fileId | int | The file id, zero-padded into the object key. |
$extension | string | The 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.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module the object belongs to; the first key segment. |
$bucketName | string | The logical bucket name; the S3 bucket and the second key segment. |
$fileId | int | The file id, zero-padded into the object key. |
$data | string | The object payload written as the object body. |
$mimeType | string | The content type; application/octet-stream is used when empty. |
$extension | string | The file extension; appended to the key, or omitted when empty. |
Returns void