PHP Класс Webiny\Component\Amazon\S3

Наследование: implements Webiny\Component\Amazon\S3\S3ClientInterface, use trait Webiny\Component\StdLib\ComponentTrait
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( $accessKeyId, $secretAccessKey, $region, $endpoint = null )
clearBucket ( string $bucket ) : integer Helper used to clear the contents of a bucket. Use the {@see ClearBucket} object directly for more advanced options and control.
copyObject ( string $sourceBucket, string $sourceKey, string $targetBucket, string $targetKey, array $params = [] ) : mixed Creates a copy of an object that is already stored in Amazon S3.
createBucket ( string $bucket, array $params = [] ) : mixed Creates a new bucket.
deleteBucket ( $bucket ) : mixed Deletes the bucket.
deleteMatchingObjects ( string $bucket, string $prefix = '', string $regex = '', array $options = [] ) : integer Deletes objects from Amazon S3 that match the result of a ListObjects operation. For example, this allows you to do things like delete all objects that match a specific key prefix.
deleteObject ( string $bucket, string $key, array $params = [] ) : mixed Removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object.
deleteObjects ( string $bucket, array $objects ) : mixed This operation enables you to delete multiple objects from a bucket using a single HTTP request.
doesBucketExist ( string $bucket, boolean $accept403 = true, array $params = [] ) : boolean Determines whether or not a bucket exists by name
doesObjectExist ( string $bucket, string $key, array $params = [] ) : boolean Determines whether or not an object exists by name
downloadBucket ( string $directory, string $bucket, string $keyPrefix = '', array $options = [] ) Downloads a bucket to the local filesystem
getBucketAcl ( string $bucket ) : mixed Get access control policy for the bucket
getBucketLocation ( string $bucket ) : mixed Returns the region the bucket resides in.
getBucketPolicy ( string $bucket ) : mixed Returns the policy of a specified bucket.
getListBucketsIterator ( ) : mixed Get array of buckets Available keys: Name, CreationDate
getListObjectsIterator ( string $bucket, array $params = [] ) : mixed Get objects iterator
getObject ( string $bucket, string $key, array $params = [] ) : mixed Get object identified by bucket and key
getObjectAcl ( $bucket, $key ) : mixed Returns the access control list (ACL) of an object.
getObjectUrl ( string $bucket, string $key, mixed $expires = null, array $args = [] ) : string Returns the URL to an object identified by its bucket and key. If an expiration time is provided, the URL will be signed and set to expire at the provided time.
listBuckets ( ) : mixed Returns a list of all buckets owned by the authenticated sender of the request.
listObjects ( string $bucket, array $params = [] ) : mixed Returns some or all (up to 1000) of the objects in a bucket.
multipartUpload ( $bucket, $key, $sourcePath, integer $concurrency = 1 ) : mixed In case of large files, use the multipartUpload method, so the file is sent in chunks to S3, without the need to read the complete file in memory.
putBucketAcl ( string $bucket, string $acl ) : mixed Sets the permissions on a bucket using access control lists (ACL).
putObject ( string $bucket, string $key, string $content, array $params = [] ) : mixed Adds an object to a bucket.
putObjectAcl ( string $bucket, string $key, string $acl ) : mixed Set the access control list (ACL) permissions for an object that already exists in a bucket
restoreObject ( string $bucket, string $key, integer $days ) : mixed Restores an archived copy of an object back into Amazon S3
uploadDirectory ( string $directory, string $bucket, string $keyPrefix = null, array $options = [] ) Recursively uploads all files in a given directory to a given bucket.

Описание методов

__construct() публичный Метод

public __construct ( $accessKeyId, $secretAccessKey, $region, $endpoint = null )
$accessKeyId
$secretAccessKey
$region
$endpoint

clearBucket() публичный Метод

Helper used to clear the contents of a bucket. Use the {@see ClearBucket} object directly for more advanced options and control.
public clearBucket ( string $bucket ) : integer
$bucket string Name of the bucket to clear.
Результат integer Returns the number of deleted keys

copyObject() публичный Метод

Creates a copy of an object that is already stored in Amazon S3.
public copyObject ( string $sourceBucket, string $sourceKey, string $targetBucket, string $targetKey, array $params = [] ) : mixed
$sourceBucket string
$sourceKey string
$targetBucket string
$targetKey string
$params array
Результат mixed

createBucket() публичный Метод

Creates a new bucket.
public createBucket ( string $bucket, array $params = [] ) : mixed
$bucket string
$params array
Результат mixed

deleteBucket() публичный Метод

All objects (including all object versions and Delete Markers) in the bucket must be deleted before the bucket itself can be deleted.
public deleteBucket ( $bucket ) : mixed
$bucket
Результат mixed

deleteMatchingObjects() публичный Метод

Deletes objects from Amazon S3 that match the result of a ListObjects operation. For example, this allows you to do things like delete all objects that match a specific key prefix.
См. также: Aws\S3\S3Client::listObjects
См. также: Aws\S3\Model\ClearBucket For more options or customization
public deleteMatchingObjects ( string $bucket, string $prefix = '', string $regex = '', array $options = [] ) : integer
$bucket string Bucket that contains the object keys
$prefix string Optionally delete only objects under this key prefix
$regex string Delete only objects that match this regex
$options array Options used when deleting the object: - before_delete: Callback to invoke before each delete. The callback will receive a Guzzle\Common\Event object with context.
Результат integer Returns the number of deleted keys

deleteObject() публичный Метод

If there isn't a null version, Amazon S3 does not remove any objects.
public deleteObject ( string $bucket, string $key, array $params = [] ) : mixed
$bucket string
$key string
$params array
Результат mixed

deleteObjects() публичный Метод

You may specify up to 1000 keys.
public deleteObjects ( string $bucket, array $objects ) : mixed
$bucket string
$objects array
Результат mixed

doesBucketExist() публичный Метод

Determines whether or not a bucket exists by name
public doesBucketExist ( string $bucket, boolean $accept403 = true, array $params = [] ) : boolean
$bucket string The name of the bucket
$accept403 boolean Set to true if 403s are acceptable
$params array Additional options to add to the executed command
Результат boolean

doesObjectExist() публичный Метод

Determines whether or not an object exists by name
public doesObjectExist ( string $bucket, string $key, array $params = [] ) : boolean
$bucket string The name of the bucket
$key string The key of the object
$params array Additional options to add to the executed command
Результат boolean

downloadBucket() публичный Метод

Downloads a bucket to the local filesystem
public downloadBucket ( string $directory, string $bucket, string $keyPrefix = '', array $options = [] )
$directory string Directory to download to
$bucket string Bucket to download from
$keyPrefix string Only download objects that use this key prefix
$options array Associative array of download options - params: Array of parameters to use with each GetObject operation performed during the transfer - base_dir: Base directory to remove from each object key when storing in the local filesystem - force: Set to true to download every file, even if the file is already on the local filesystem and has not changed - concurrency: Maximum number of parallel downloads (defaults to 10) - debug: Set to true or a fopen resource to enable debug mode to print information about each download - allow_resumable: Set to true to allow previously interrupted downloads to be resumed using a Range GET

getBucketAcl() публичный Метод

Get access control policy for the bucket
public getBucketAcl ( string $bucket ) : mixed
$bucket string
Результат mixed

getBucketLocation() публичный Метод

Returns the region the bucket resides in.
public getBucketLocation ( string $bucket ) : mixed
$bucket string
Результат mixed

getBucketPolicy() публичный Метод

Returns the policy of a specified bucket.
public getBucketPolicy ( string $bucket ) : mixed
$bucket string
Результат mixed

getListBucketsIterator() публичный Метод

Get array of buckets Available keys: Name, CreationDate
public getListBucketsIterator ( ) : mixed
Результат mixed

getListObjectsIterator() публичный Метод

Get objects iterator
public getListObjectsIterator ( string $bucket, array $params = [] ) : mixed
$bucket string
$params array
Результат mixed

getObject() публичный Метод

Get object identified by bucket and key
public getObject ( string $bucket, string $key, array $params = [] ) : mixed
$bucket string
$key string
$params array
Результат mixed

getObjectAcl() публичный Метод

Returns the access control list (ACL) of an object.
public getObjectAcl ( $bucket, $key ) : mixed
$bucket
$key
Результат mixed

getObjectUrl() публичный Метод

Returns the URL to an object identified by its bucket and key. If an expiration time is provided, the URL will be signed and set to expire at the provided time.
public getObjectUrl ( string $bucket, string $key, mixed $expires = null, array $args = [] ) : string
$bucket string The name of the bucket where the object is located
$key string The key of the object
$expires mixed The time at which the URL should expire
$args array Arguments to the GetObject command. Additionally you can specify a "Scheme" if you would like the URL to use a different scheme than what the client is configured to use
Результат string The URL to the object

listBuckets() публичный Метод

Available keys: Name, CreationDate
public listBuckets ( ) : mixed
Результат mixed

listObjects() публичный Метод

You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
public listObjects ( string $bucket, array $params = [] ) : mixed
$bucket string
$params array
Результат mixed

multipartUpload() публичный Метод

In case of large files, use the multipartUpload method, so the file is sent in chunks to S3, without the need to read the complete file in memory.
public multipartUpload ( $bucket, $key, $sourcePath, integer $concurrency = 1 ) : mixed
$bucket
$key
$sourcePath
$concurrency integer
Результат mixed

putBucketAcl() публичный Метод

Sets the permissions on a bucket using access control lists (ACL).
public putBucketAcl ( string $bucket, string $acl ) : mixed
$bucket string
$acl string private | public-read | public-read-write | authenticated-read
Результат mixed

putObject() публичный Метод

Adds an object to a bucket.
public putObject ( string $bucket, string $key, string $content, array $params = [] ) : mixed
$bucket string
$key string
$content string
$params array
Результат mixed

putObjectAcl() публичный Метод

Set the access control list (ACL) permissions for an object that already exists in a bucket
public putObjectAcl ( string $bucket, string $key, string $acl ) : mixed
$bucket string
$key string
$acl string private | public-read | public-read-write | authenticated-read | bucket-owner-read | bucket-owner-full-control
Результат mixed

restoreObject() публичный Метод

Restores an archived copy of an object back into Amazon S3
public restoreObject ( string $bucket, string $key, integer $days ) : mixed
$bucket string
$key string
$days integer
Результат mixed

uploadDirectory() публичный Метод

Recursively uploads all files in a given directory to a given bucket.
См. также: Aws\S3\S3Sync\S3Sync for more options and customization
public uploadDirectory ( string $directory, string $bucket, string $keyPrefix = null, array $options = [] )
$directory string Full path to a directory to upload
$bucket string Name of the bucket
$keyPrefix string Virtual directory key prefix to add to each upload
$options array Associative array of upload options - params: Array of parameters to use with each PutObject operation performed during the transfer - base_dir: Base directory to remove from each object key - force: Set to true to upload every file, even if the file is already in Amazon S3 and has not changed - concurrency: Maximum number of parallel uploads (defaults to 10) - debug: Set to true or an fopen resource to enable debug mode to print information about each upload - multipart_upload_size: When the size of a file exceeds this value, the file will be uploaded using a multipart upload.