Installation guide
Installing via Zip
Each release of the AWS SDK for PHP (since 2.3.2) ships with a zip file containing all of the classes and
dependencies you need to run the SDK in a PSR-0 compatible directory structure. Additionally, the zip file includes a
class autoloader for the AWS SDK for PHP and the following required and suggested libraries:
• Guzzle for HTTP requests
• Symfony2 EventDispatcher for events
• Monolog and Psr\Log for logging
• Doctrine for caching
Using the zip file is great if you:
1. Prefer not to or cannot use package managers like Composer and PEAR.
2. Cannot use phar files due to environment limitations.
3. Want to use only specific files from the SDK.
To get started, you must download the zip file, unzip it into your project to a location of your choosing, and include
the autoloader:
require '/path/to/aws-autoloader.php';
Alternatively, you can write your own autoloader or use an existing one from your project.
If you have phing installed, you can clone the SDK and build a zip file yourself using the "zip" task.
Installing via PEAR
PEAR packages are easy to install, and are available in your PHP environment path so that they are accessible to
any PHP project. PEAR packages are not specific to your project, but rather to the machine they're installed on.
From the command-line, you can install the SDK with PEAR as follows (this might need to be run as sudo):
pear config-set auto_discover 1
pear channel-discover pear.amazonwebservices.com
pear install aws/sdk
Alternatively, you can combine all three of the preceding statements into one by doing the following:
pear -D auto_discover=1 install pear.amazonwebservices.com/sdk
Once the SDK has been installed via PEAR, you can include the aws.phar into your project with:
require 'AWSSDKforPHP/aws.phar';
This assumes that the PEAR directory is in your PHP include path, which it probably is, if PEAR is working correctly.
If needed, you can determine your PEAR directory by running pear config-get php_dir.
Getting Started Guide
This "Getting Started Guide" focuses on basic usage of the AWS SDK for PHP. After reading through this material,
you should be familiar with the SDK and be able to start using the SDK in your application. This guide assumes that
you have already downloaded and installed the SDK and retrieved your AWS access keys.
Including the SDK
No matter which technique you have used to to install the SDK, the SDK can be included into your project or script
with just a single include (or require) statement. Please refer to the following table for the PHP code that best fits
your installation technique. Please replace any instances of /path/to/ with the actual path on your system.
Installation
Technique Include Statement
Getting Started Guide
4