- 
      
- 
        Save chapdel/4a40308942d14695d7f827bac7f6f46f to your computer and use it in GitHub Desktop. 
Revisions
- 
        Harshavardhana created this gist Feb 2, 2016 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ <?php // Include the SDK using the Composer autoloader date_default_timezone_set('America/Los_Angeles'); require 'vendor/autoload.php'; $s3 = new Aws\S3\S3Client([ 'version' => 'latest', 'region' => 'us-east-1', 'endpoint' => 'http://localhost:9000' ]); $result = $s3->listBuckets(); echo "ListBuckets: \n"; foreach ($result['Buckets'] as $bucket) { echo $bucket['Name'] . " " . $bucket['CreationDate'] . "\n"; } echo "ListObjects: \n"; $results = $s3->getPaginator('ListObjects', [ 'Bucket' => 'testbucket' ]); foreach ($results as $result) { foreach ($result['Contents'] as $object) { echo $object['Key'] . " " . $object['Size'] . "\n"; } } echo "ListObjects: delimited\n"; $results = $s3->getPaginator('ListObjects', [ 'Bucket' => 'testbucket', 'Delimiter' => '/' ]); $expression = '[CommonPrefixes[].Prefix, Contents[].Key][]'; foreach ($results->search($expression) as $item) { echo $item . "\n"; } 
 Harshavardhana
              created
            
            this gist
            
              Harshavardhana
              created
            
            this gist