I had the same problem, and I solved this using:
use \Aws\S3\StreamWrapper;
use \Aws\S3\S3Client;
private $files = array();
private $s3path = 'YOUR_BUCKET';
private $s3key = 'YOUR_KEY';
private $s3auth = 'YOUR_AUTH_CODE';
public function recursive($path)
{
$dirHandle = scandir($path);
foreach($dirHandle as $file)
{
if(is_dir($path.$file."/") && $file != '.' && $file != '..')
{
$this->recursive($path.$file."/");
}
else
{
$this->files[$path.$file] = $path.$file;
}
}
}
public function registerS3()
{
$client = S3Client::factory(array(
'key' => $this->s3key,
'secret' => $this->s3auth
));
$wp = new StreamWrapper();
$wp->register($client);
}
public function run()
{
$folder = 's3://'.$this->s3path.'/';
$this->registerS3();
$this->recursive($folder);
}
Now, if you do a DUMP in $this->files, should show all the files on the bucket.