Installation guide
Another easy way to list the contents of the bucket is using the Symfony2 Finder component.
<?php
require 'vendor/autoload.php';
use Symfony\Component\Finder\Finder;
$aws = Aws\Common\Aws::factory('/path/to/config.json');
$s3 = $aws->get('s3')->registerStreamWrapper();
$finder = new Finder();
// Get all files and folders (key prefixes) from "bucket" that are less than 100k
// and have been updated in the last year
$finder->in('s3://bucket')
->size('< 100K')
->date('since 1 year ago');
foreach ($finder as $file) {
echo $file->getType() . ": {$file}\n";
}
The AWS SDK for PHP enables PHP developers to use Amazon Web Services from their PHP code, and build
robust applications and software using services like Amazon S3, Amazon DynamoDB, Amazon Glacier, etc. You
can get started in minutes by installing the SDK through Composer — by requiring the aws/aws-sdk-php
package — or by downloading the standalone aws.zip or aws.phar files.
Getting Started
• Before you use the SDK
• Sign up for AWS and get your AWS access keys
• Verify that your system meets the minimum requirements for the SDK
• Install the AWS SDK for PHP
• Using the SDK
• Getting Started Guide – Everything you need to know to use the AWS SDK for PHP
• Sample Project
• Migrating from Version 1 of the SDK?
• Migration Guide – Migrating from Version 1 of the SDK to Version 2
• Side-by-side Guide – Using Version 1 and Version 2 of the SDK side-by-side in the same project
In-Depth Guides
• Providing Credentials to the SDK
• Configuring the SDK
Getting Started
135