Installation guide

Response Models contain the parsed data from the response from a service operation, so the contents of the model
will be different depending on which operation you've performed.
The SDK's API docs are the best resource for discovering what the model object will contain for a given operation.
The API docs contain a full specification of the data in the response model under the Returns section of the docs for
an operation (e.g., S3 GetObject operation, EC2 RunInstances operation).
From within your code you can convert the response model directly into an array using the toArray() method. If
you are doing some debugging in your code, you could use toArray() in conjunction with print_r() to print
out a simple representation of the response data.
$result = $ec2Client->runInstances(array(/* ... */));
print_r($result->toArray());
You can also examine the service description for a service, which is located in the Resources directory within a
given client's namespace directory. For example, here is a snippet from the SQS service description (located in
src/Aws/Sqs/Resources/) that shows the schema for the response of the SendMessage operation.
// ...
'SendMessageResult' => array(
'type' => 'object',
'additionalProperties' => true,
'properties' => array(
'MD5OfMessageBody' => array(
'description' => 'An MD5 digest of the non-URL-encoded message body string. This can be used [...]',
'type' => 'string',
'location' => 'xml',
),
'MessageId' => array(
'description' => 'The message ID of the message added to the queue.',
'type' => 'string',
'location' => 'xml',
),
),
),
// ...
Getting Response Headers
The Response object is not directly accessible from the Model object. If you are interested in getting header
values, the status code, or other data from the response you will need to get the Response object from the
Command object (see Command Objects). You may need to switch from using the shorthand command syntax to the
expanded syntax so that the command object can be accessed directly.
// Getting the response Model with the shorthand syntax
$result = $s3Client->createBucket(array(/* ... */));
// Getting the response Model with the expanded syntax
$command = $s3Client->getCommand('CreateBucket', array(/* ... */));
$result = $command->getResult();
// Getting the Response object from the Command
$response = $command->getResponse();
$contentLength = $response->getHeader('Content-Length');
$statusCode = $response->getStatusCode();
In some cases, particularly with REST-like services like Amazon S3 and Amazon Glacier, most of the important
headers are already included in the response model.
Static Client Facades
Introduction
Static Client Facades
39