Documentation

AwsS3Adapter extends AbstractAdapter
in package
implements CanOverwriteFiles

Interfaces, Classes and Traits

CanOverwriteFiles
Adapters that implement this interface let the Filesystem know that files can be overwritten using the write functions and don't need the update function to be called. This can help improve performance when asserts are disabled.

Table of Contents

PUBLIC_GRANT_URI  = 'http://acs.amazonaws.com/groups/global/AllUsers'
$bucket  : string
$metaOptions  : array<string|int, mixed>
$options  : array<string|int, mixed>
$pathPrefix  : string|null
$pathSeparator  : string
$resultMap  : array<string|int, mixed>
$s3Client  : S3ClientInterface
$streamReads  : bool
__construct()  : mixed
applyPathPrefix()  : string
Prefix a path.
copy()  : bool
Copy a file.
createDir()  : bool|array<string|int, mixed>
Create a directory.
delete()  : bool
Delete a file.
deleteDir()  : bool
Delete a directory.
getBucket()  : string
Get the S3Client bucket.
getClient()  : S3ClientInterface
Get the S3Client instance.
getMetadata()  : false|array<string|int, mixed>
Get all the meta data of a file or directory.
getMimetype()  : false|array<string|int, mixed>
Get the mimetype of a file.
getPathPrefix()  : string|null
Get the path prefix.
getSize()  : false|array<string|int, mixed>
Get all the meta data of a file or directory.
getTimestamp()  : false|array<string|int, mixed>
Get the timestamp of a file.
getVisibility()  : array<string|int, mixed>|false
Get the visibility of a file.
has()  : bool
Check whether a file exists.
listContents()  : array<string|int, mixed>
List contents of a directory.
read()  : false|array<string|int, mixed>
Read a file.
readStream()  : array<string|int, mixed>|false
Read a file as a stream.
removePathPrefix()  : string
Remove a path prefix.
rename()  : bool
Rename a file.
setBucket()  : string
Set the S3Client bucket.
setPathPrefix()  : void
Set the path prefix.
setVisibility()  : array<string|int, mixed>|false
Set the visibility for a file.
update()  : false|array<string|int, mixed>
Update a file.
updateStream()  : array<string|int, mixed>|false
Update a file using a stream.
write()  : false|array<string|int, mixed>
Write a new file.
writeStream()  : array<string|int, mixed>|false
Write a new file using a stream.
doesDirectoryExist()  : bool
getOptionsFromConfig()  : array<string|int, mixed>
Get options from the config.
getRawVisibility()  : string
Get the object acl presented as a visibility.
normalizeResponse()  : array<string|int, mixed>
Normalize the object result array.
readObject()  : array<string|int, mixed>|bool
Read an object and normalize the response.
retrievePaginatedListing()  : array<string|int, mixed>
upload()  : array<string|int, mixed>|bool
Upload an object.
is404Exception()  : bool
isOnlyDir()  : bool
Check if the path contains only directories

Constants

PUBLIC_GRANT_URI

public mixed PUBLIC_GRANT_URI = 'http://acs.amazonaws.com/groups/global/AllUsers'

Properties

$metaOptions

protected static array<string|int, mixed> $metaOptions = ['ACL', 'CacheControl', 'ContentDisposition', 'ContentEncoding', 'ContentLength', 'ContentType', 'Expires', 'GrantFullControl', 'GrantRead', 'GrantReadACP', 'GrantWriteACP', 'Metadata', 'RequestPayer', 'SSECustomerAlgorithm', 'SSECustomerKey', 'SSECustomerKeyMD5', 'SSEKMSKeyId', 'ServerSideEncryption', 'StorageClass', 'Tagging', 'WebsiteRedirectLocation']

$options

protected array<string|int, mixed> $options = []

$resultMap

protected static array<string|int, mixed> $resultMap = ['Body' => 'contents', 'ContentLength' => 'size', 'ContentType' => 'mimetype', 'Size' => 'size', 'Metadata' => 'metadata', 'StorageClass' => 'storageclass', 'ETag' => 'etag', 'VersionId' => 'versionid']

Methods

__construct()

public __construct(S3ClientInterface $client, mixed $bucket[, mixed $prefix = '' ][, array<string|int, mixed> $options = [] ][, mixed $streamReads = true ]) : mixed
Parameters
$client : S3ClientInterface
$bucket : mixed
$prefix : mixed = ''
$options : array<string|int, mixed> = []
$streamReads : mixed = true
Return values
mixed

applyPathPrefix()

Prefix a path.

public applyPathPrefix(mixed $path) : string
Parameters
$path : mixed
Return values
string

prefixed path

copy()

Copy a file.

public copy(string $path, string $newpath) : bool
Parameters
$path : string
$newpath : string
Return values
bool

createDir()

Create a directory.

public createDir(string $dirname, Config $config) : bool|array<string|int, mixed>
Parameters
$dirname : string

directory name

$config : Config
Return values
bool|array<string|int, mixed>

delete()

Delete a file.

public delete(string $path) : bool
Parameters
$path : string
Return values
bool

deleteDir()

Delete a directory.

public deleteDir(string $dirname) : bool
Parameters
$dirname : string
Return values
bool

getBucket()

Get the S3Client bucket.

public getBucket() : string
Return values
string

getMetadata()

Get all the meta data of a file or directory.

public getMetadata(string $path) : false|array<string|int, mixed>
Parameters
$path : string
Return values
false|array<string|int, mixed>

getMimetype()

Get the mimetype of a file.

public getMimetype(string $path) : false|array<string|int, mixed>
Parameters
$path : string
Return values
false|array<string|int, mixed>

getPathPrefix()

Get the path prefix.

public getPathPrefix() : string|null
Return values
string|null

path prefix or null if pathPrefix is empty

getSize()

Get all the meta data of a file or directory.

public getSize(string $path) : false|array<string|int, mixed>
Parameters
$path : string
Return values
false|array<string|int, mixed>

getTimestamp()

Get the timestamp of a file.

public getTimestamp(string $path) : false|array<string|int, mixed>
Parameters
$path : string
Return values
false|array<string|int, mixed>

getVisibility()

Get the visibility of a file.

public getVisibility(string $path) : array<string|int, mixed>|false
Parameters
$path : string
Return values
array<string|int, mixed>|false

has()

Check whether a file exists.

public has(string $path) : bool
Parameters
$path : string
Return values
bool

listContents()

List contents of a directory.

public listContents([string $directory = '' ][, bool $recursive = false ]) : array<string|int, mixed>
Parameters
$directory : string = ''
$recursive : bool = false
Return values
array<string|int, mixed>

read()

Read a file.

public read(string $path) : false|array<string|int, mixed>
Parameters
$path : string
Return values
false|array<string|int, mixed>

readStream()

Read a file as a stream.

public readStream(string $path) : array<string|int, mixed>|false
Parameters
$path : string
Return values
array<string|int, mixed>|false

removePathPrefix()

Remove a path prefix.

public removePathPrefix(string $path) : string
Parameters
$path : string
Return values
string

path without the prefix

rename()

Rename a file.

public rename(string $path, string $newpath) : bool
Parameters
$path : string
$newpath : string
Return values
bool

setBucket()

Set the S3Client bucket.

public setBucket(mixed $bucket) : string
Parameters
$bucket : mixed
Return values
string

setPathPrefix()

Set the path prefix.

public setPathPrefix(mixed $prefix) : void
Parameters
$prefix : mixed
Return values
void

setVisibility()

Set the visibility for a file.

public setVisibility(string $path, string $visibility) : array<string|int, mixed>|false
Parameters
$path : string
$visibility : string
Return values
array<string|int, mixed>|false

file meta data

update()

Update a file.

public update(string $path, string $contents, Config $config) : false|array<string|int, mixed>
Parameters
$path : string
$contents : string
$config : Config

Config object

Return values
false|array<string|int, mixed>

false on failure file meta data on success

updateStream()

Update a file using a stream.

public updateStream(string $path, resource $resource, Config $config) : array<string|int, mixed>|false
Parameters
$path : string
$resource : resource
$config : Config

Config object

Return values
array<string|int, mixed>|false

false on failure file meta data on success

write()

Write a new file.

public write(string $path, string $contents, Config $config) : false|array<string|int, mixed>
Parameters
$path : string
$contents : string
$config : Config

Config object

Return values
false|array<string|int, mixed>

false on failure file meta data on success

writeStream()

Write a new file using a stream.

public writeStream(string $path, resource $resource, Config $config) : array<string|int, mixed>|false
Parameters
$path : string
$resource : resource
$config : Config

Config object

Return values
array<string|int, mixed>|false

false on failure file meta data on success

doesDirectoryExist()

protected doesDirectoryExist(string $location) : bool
Parameters
$location : string
Return values
bool

getOptionsFromConfig()

Get options from the config.

protected getOptionsFromConfig(Config $config) : array<string|int, mixed>
Parameters
$config : Config
Return values
array<string|int, mixed>

getRawVisibility()

Get the object acl presented as a visibility.

protected getRawVisibility(string $path) : string
Parameters
$path : string
Return values
string

normalizeResponse()

Normalize the object result array.

protected normalizeResponse(array<string|int, mixed> $response[, string $path = null ]) : array<string|int, mixed>
Parameters
$response : array<string|int, mixed>
$path : string = null
Return values
array<string|int, mixed>

readObject()

Read an object and normalize the response.

protected readObject(string $path) : array<string|int, mixed>|bool
Parameters
$path : string
Return values
array<string|int, mixed>|bool

retrievePaginatedListing()

protected retrievePaginatedListing(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed>
Return values
array<string|int, mixed>

upload()

Upload an object.

protected upload(string $path, string|resource $body, Config $config) : array<string|int, mixed>|bool
Parameters
$path : string
$body : string|resource
$config : Config
Return values
array<string|int, mixed>|bool

isOnlyDir()

Check if the path contains only directories

private isOnlyDir(string $path) : bool
Parameters
$path : string
Return values
bool

Search results