PHP Class S3Browser, s3browser

Mostrar archivo Open project: powdahound/s3browser Class Usage Examples

Public Methods

Method Description
__construct ( $bucketName, $accessKey, $secretKey, $useSSL = true, $endPoint = 's3.amazonaws.com' )
enableCaching ( string $dir, string $duration ) : void Enable caching of files list so S3 doesn't have to be queried on every request
getBreadcrumb ( string $path = '/' ) : array Returns directory data for all levels of the given path to be used when displaying a breadcrumb.
getFiles ( string $path = '/' ) : array Returns list of file objects in the given path
getParent ( string $path = '/' ) : array Returns parent directory
getTree ( ) : array Build a tree representing the directory structure of the bucket's contents.

Private Methods

Method Description
formatSize ( string $bytes ) : string Takes a size in bytes and converts it to a more human-readable format
getBucketContents ( ) : array Get S3 bucket contents (from cache if possible)
sort ( $a, $b ) Sort with dirs first, then alphabetical ascending

Method Details

__construct() public method

public __construct ( $bucketName, $accessKey, $secretKey, $useSSL = true, $endPoint = 's3.amazonaws.com' )

enableCaching() public method

Enable caching of files list so S3 doesn't have to be queried on every request
public enableCaching ( string $dir, string $duration ) : void
$dir string Location to cache listing
$duration string Time in seconds before expiring cache
return void

getBreadcrumb() public static method

Returns directory data for all levels of the given path to be used when displaying a breadcrumb.
public static getBreadcrumb ( string $path = '/' ) : array
$path string
return array

getFiles() public method

Returns list of file objects in the given path
public getFiles ( string $path = '/' ) : array
$path string Directory path
return array Directory contents

getParent() public static method

Returns parent directory
public static getParent ( string $path = '/' ) : array
$path string
return array

getTree() public method

Build a tree representing the directory structure of the bucket's contents.
public getTree ( ) : array
return array