Developer Preview - Resource APIs for Version 3 of AWS SDK for PHP

Posted on: Jan 7, 2015

The new Resource APIs for AWS SDK for PHP is an extension library to the SDK that introduces PHP developers to a more intuitive, object-oriented perspective in working with AWS resources. While the SDK's traditional request-response or RPC-style clients provide granular and explicit control over the network calls made by the SDK, Resource APIs represent AWS resources as PHP objects with methods and attributes that can be called and accessed directly on the object rather than passing parameters to and from client operations.

Here are some examples to demonstrate:

// Use resource objects to access attributes and perform actions
$aws = new Aws($config);
$bucket = $aws->s3->bucket('my-bucket');
$object = $bucket->object('my-object.txt');
echo $object['LastModified'];
$object->delete();

// Easily iterate through paginated resource lists
foreach ($bucket->objects() as $object) {
echo "Deleting object {$object['Key']}...\n";
$object->delete();
}

Currently the Resource APIs support 7 services - Amazon EC2, Amazon S3, Amazon Glacier, Amazon SNS, Amazon SQS, AWS CloudFormation, and AWS IAM. More services will be supported in the near future. We encourage users of the AWS SDK for PHP to try out the new Resource APIs and send us feedback in GitHub issues (https://github.com/awslabs/aws-sdk-php-resources/issues).

Additional resources:

Browse the source code
Add the Composer package to your project
Read the blog post