Installation guide
print_r($people);
From Version 2 of the SDK
<?php
require '/path/to/vendor/autoload.php';
use Aws\Common\Aws;
use Aws\DynamoDb\Enum\ComparisonOperator;
use Aws\DynamoDb\Enum\Type;
$aws = Aws::factory('/path/to/config.php');
$dynamodb = $aws->get('dynamodb');
// Create a ScanIterator and setup the parameters for the DynamoDB Scan operation
$scan = $dynamodb->getIterator('Scan', array(
'TableName' => 'people',
'AttributesToGet' => array('id', 'age', 'name'),
'ScanFilter' => array(
'age' => array(
'ComparisonOperator' => ComparisonOperator::GE,
'AttributeValueList' => array(
array(Type::NUMBER => '16')
)
),
)
));
// Perform as many Scan operations as needed to acquire all the names of people
// that are 16 or older
$people = array();
foreach ($scan as $item) {
$people[] = $item['name'][Type::STRING];
}
print_r($people);
Side-by-side Guide
This guide helps you install, configure, and run Version 1 and Version 2 of the AWS SDK for PHP side-by-side within
the same application or project. Please see the Migration Guide for more information on migrating code from the
original AWS SDK for PHP to Version 2.
Since Version 2 of the AWS SDK for PHP now supports all of the AWS services supported by Version 1 (and more),
it is recommended that you should begin migrating your code to use Version 2 of the SDK. Using both SDKs
side-by-side may be helpful if your use case requires you to migrate only sections of your code at a time.
Installing and Including the SDKs
To install and include the SDKs in your project, you must first choose whether or not to use Composer.
Using Composer
Using Composer is the recommended way to install both versions of the AWS SDK for PHP. Composer is a
dependency management tool for PHP that allows you to declare the dependencies your project requres and installs
them into your project. In order to simultaneously use both versions of the SDK in the same project through
Composer, you must do the following:
Side-by-side Guide
15