Installation guide
use Guzzle\Common\Log\MonologLogAdapter;
use Guzzle\Plugin\Log\LogPlugin;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
// Create a log channel
$log = new Logger('aws');
$log->pushHandler(new StreamHandler('/path/to/your.log', Logger::WARNING));
// Create a log adapter for Monolog
$logger = new MonologLogAdapter($log);
// Create the LogPlugin
$logPlugin = new LogPlugin($logger);
// Create an Amazon S3 client
$s3Client = S3Client::factory();
// Add the LogPlugin to the client
$s3Client->addSubscriber($logPlugin);
You can find out more about the LogPlugin on the Guzzle website:
http://guzzlephp.org/guide/plugins.html#log-plugin
How can I set arbitrary headers on a request?
You can add any arbitrary headers to a service operation by setting the command.headers value. The following
example shows how to add an X-Foo-Baz header to an Amazon S3 PutObject operation.
$s3Client = S3Client::factory();
$s3Client->putObject(array(
'Key' => 'test',
'Bucket' => 'mybucket',
'command.headers' => array(
'X-Foo-Baz' => 'Bar'
)
));
Does the SDK follow semantic versioning?
Yes. The SDK follows a semantic versioning scheme similar to – but not the same as – semver. Instead of the
MAJOR.MINOR.PATCH scheme specified by semver, the SDK actually follows a scheme that looks like
PARADIGM.MAJOR.MINOR where:
1. The PARADIGM version number is incremented when drastic, breaking changes are made to the SDK, such
that the fundamental way of using the SDK is different. You are probably aware that version 1.x and version 2.x
of the AWS SDK for PHP are very different.
2. The MAJOR version number is incremented when breaking changes are made to the API. These are usually
small changes, and only occur when one of the services makes breaking changes changes to their API. Make
sure to check the CHANGELOG and UPGRADING documents when these changes occur.
3. The MINOR version number is incremented when any backwards-compatible change is made, whether it's a
new feature or a bug fix.
The best way to ensure that you are not affected by breaking changes is to set your dependency on the SDK in
Composer to stay within a particular PARADIGM.MAJOR version. This can be done using the wildcard syntax:
{
"require": {
"aws/aws-sdk-php": "2.4.*"
}
}
Frequently Asked Questions (FAQ)
48