Installation guide

// New SDK - PutObject operation
$result = $s3->putObject(array(
'Bucket' => 'bucket-name',
'Key' => 'object-key.txt',
'Body' => 'lorem ipsum'
));
In the new SDK, the putObject() method doesn't actually exist as a method on the client. It is implemented using
the __call() magic method of the client and acts as a shortcut to instantiate a command, execute the command,
and retrieve the result.
A Command object encapsulates the request and response of the call to AWS. From the Command object, you can
call the getResult() method (as in the preceding example) to retrieve the parsed result, or you can call the
getResponse() method to retrieve data about the response (e.g., the status code or the raw response).
The Command object can also be useful when you want to manipulate the command before execution or need to
execute several commands in parallel. The following is an example of the same PutObject operation using the
command syntax:
$command = $s3->getCommand('PutObject', array(
'Bucket' => 'bucket-name',
'Key' => 'object-key.txt',
'Body' => 'lorem ipsum'
));
$result = $command->getResult();
Or you can use the chainable set() method on the Command object:
$result = $s3->getCommand('PutObject')
->set('Bucket', 'bucket-name')
->set('Key', 'object-key.txt')
->set('Body', 'lorem ipsum')
->getResult();
Responses
The format of responses has changed. Responses are no longer instances of the CFResponse object. The
Command object (as seen in the preceding section) of the new SDK encapsulates the request and response, and is
the object from which to retrieve the results.
// Previous SDK
// Execute the operation and get the CFResponse object
$response = $s3->list_tables();
// Get the parsed response body as a SimpleXMLElement
$result = $response->body;
// New SDK
// Executes the operation and gets the response in an array-like object
$result = $s3->listTables();
The new syntax is similar, but a few fundamental differences exist between responses in the previous SDK and this
version:
The new SDK represents parsed responses (i.e., the results) as Guzzle Model objects instead of CFSimpleXML
objects as in the prior version. These Model objects are easy to work with since they act like arrays. They also have
helpful built-in features such as mapping and filtering. The content of the results will also look different n this version
of the SDK. The SDK marshals responses into the models and then transforms them into more convenient
structures based on the service description. The API documentation details the response of all operations.
Exceptions
The new SDK uses exceptions to communicate errors and bad responses.
Migration Guide
11