There are 3 supported methods of installing the AWS SDK for PHP. The recommended way to install the SDK is through Composer.
Using Composer is the recommended way to install the AWS SDK for PHP. Composer is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project.
Install Composer
curl -sS https://getcomposer.org/installer | php
Run the Composer command to install the latest stable version of the SDK:
php composer.phar require aws/aws-sdk-php
Require Composer's autoloader:
<?php
require 'vendor/autoload.php';
You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.
You can download the packaged phar and simply include it in your scripts to get started:
<?php
require '/path/to/aws.phar';
Each release of the AWS SDK for PHP ships with a pre-packaged phar (PHP archive) file containing all of the classes and dependencies you need to run the SDK. Additionally, the phar file automatically registers a class autoloader for the AWS SDK for PHP and all of its dependencies when included.
Note
If you are using PHP with the Suhosin patch (not recommended, but common on
Ubuntu and Debian distributions), you may need to enable the use of phars in
the suhosin.ini
. Without this, including a phar file in your code will
cause it to silently fail. You should modify the suhosin.ini
file by
adding the line:
suhosin.executor.include.whitelist = phar
Each release of the AWS SDK for PHP ships with a zip file containing all of the classes and dependencies you need to run the SDK. Additionally, the zip file includes a class autoloader for the AWS SDK for PHP and all of its dependencies.
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';