\Pivot\Core\ServicesS3Uploader

Handles client management from S3

Summary

Methods
Properties
Constants
__construct()
getBucketObjectsIterator()
listBuckets()
listAllBucketItems()
downloadToFile()
downloadToTempFile()
downloadToLocation()
getFile()
uploadFile()
doesObjectExist()
deleteFile()
uploadFolder()
getClient()
getDefaultBucket()
No public properties found
No constants found
No protected methods found
$default_bucket
$client
N/A
No private methods found
$key
N/A

Properties

$default_bucket

$default_bucket : string

The default bucket incase one is not supplied

Type

string

$client

$client : \Pivot\Core\Services\Aws\S3\S3Client

S3 Client

Type

\Pivot\Core\Services\Aws\S3\S3Client

$key

$key : string

AWS Key

Type

string

Methods

__construct()

__construct(string  $default_bucket, string  $key, \Aws\S3\S3Client  $client) 

construct this S3 Uploader

Parameters

string $default_bucket

default bucket

string $key

AWS key

\Aws\S3\S3Client $client

Aws\S3\S3Client

getBucketObjectsIterator()

getBucketObjectsIterator(string  $bucket = null, array  $options = array()) : \Pivot\Core\Services\iterator

Get an iterator to go over a buckets contents

Parameters

string $bucket

bucket to look into

array $options

options for the s3 iterator

Returns

\Pivot\Core\Services\iterator

listBuckets()

listBuckets() : \Pivot\Core\Services\echo-ed

List avaliable buckets

Returns

\Pivot\Core\Services\echo-ed —

string

listAllBucketItems()

listAllBucketItems(string  $bucket) : \Pivot\Core\Services\echo-ed

List all bucket items

Parameters

string $bucket

Returns

\Pivot\Core\Services\echo-ed —

string

downloadToFile()

downloadToFile(string  $fileKey, string  $bucket = null) : \Pivot\Core\Services\file

Download an S3 object to a file

Parameters

string $fileKey

file key to download

string $bucket

bucket to override defaults

Returns

\Pivot\Core\Services\file —

object

downloadToTempFile()

downloadToTempFile(  $fileKey, string  $tempName = null, null  $bucket = null) : \Guzzle\Service\Resource\Model

Parameters

$fileKey
string $tempName
null $bucket

Returns

\Guzzle\Service\Resource\Model

downloadToLocation()

downloadToLocation(  $fileKey,   $fileName, null  $bucket = null) : \Guzzle\Service\Resource\Model

Parameters

$fileKey
$fileName
null $bucket

Returns

\Guzzle\Service\Resource\Model

getFile()

getFile(  $fileKey,   $bucket = null) 

returns aws s3 file object

Parameters

$fileKey
$bucket

uploadFile()

uploadFile(string  $fileKey,   $stream, string  $bucket = null) : \Pivot\Core\Services\fileObject

Upload a file to S3

Parameters

string $fileKey

file key to download

$stream
string $bucket

bucket to override default

Returns

\Pivot\Core\Services\fileObject

doesObjectExist()

doesObjectExist(object  $object) : \Pivot\Core\Services\client

Checks to see if S3 contains an object

Parameters

object $object

object to look for

Returns

\Pivot\Core\Services\client —

result

deleteFile()

deleteFile(string  $fileKey) : \Pivot\Core\Services\file

Removes a file from S3

Parameters

string $fileKey

Key of file to remove

Returns

\Pivot\Core\Services\file —

object

uploadFolder()

uploadFolder(string  $directory, string  $bucket, string  $keyPrefix) : void

Uploads a foldre to S3

Parameters

string $directory

local path to upload

string $bucket

bucket

string $keyPrefix

prefix to folder

getClient()

getClient() : \Pivot\Core\Services\s3Client

get the S3 client

Returns

\Pivot\Core\Services\s3Client

getDefaultBucket()

getDefaultBucket() : string

Get the default bucket

Returns

string —

$this->bucket