AWS SDK for PHP


NOTE: This is the repository for version 1 of the AWS SDK for PHP. We encourage you to upgrade to the AWS SDK for PHP 2, see http://github.com/aws/aws-sdk-php.


The AWS SDK for PHP enables developers to build solutions for Amazon Simple Storage Service (Amazon S3), Amazon Elastic Compute Cloud (Amazon EC2), Amazon SimpleDB, and more. With the AWS SDK for PHP, developers can get started in minutes with a single, downloadable package.

The SDK features:

For more information about the AWS SDK for PHP, including a complete list of supported services, see aws.amazon.com/sdkforphp.

Staying up-to-date!

We tend to release new updates very frequently. In order to keep up with the newest features and the latest bug fixes, we encourage you to subscribe to our release announcements, and to keep your code current.

Release announcements

You can subscribe to release announcements via:

Only the RSS feed is supported by AWS. The other channels are bots created/managed by third-parties.

Getting the latest versions

You can get the latest version of the SDK via:

Source

The source tree for includes the following files and directories:

Minimum Requirements in a nutshell

If you’re not sure whether your PHP environment meets these requirements, run the SDK Compatibility Test script included in the SDK download.

Installation

Via GitHub

Git is an extremely fast, efficient, distributed version control system ideal for the collaborative development of software. GitHub is the best way to collaborate with others. Fork, send pull requests and manage all your public and private git repositories. We believe that GitHub is the ideal service for working collaboratively with the open source PHP community.

Git is primarily a command-line tool. GitHub provides instructions for installing Git on Mac OS X, Windows, and Linux. If you’re unfamiliar with Git, there are a variety of resources on the net that will help you learn more:

If you’re comfortable working with Git and/or GitHub, you can pull down the source code as follows:

git clone git://github.com/amazonwebservices/aws-sdk-for-php.git AWSSDKforPHP
cd ./AWSSDKforPHP

Via PEAR

PEAR stands for the PHP Extension and Application Repository and is a framework and distribution system for reusable PHP components. It is the PHP equivalent to package management software such as MacPorts and Homebrew for Mac OS X, Yum and Apt for GNU/Linux, RubyGems for Ruby, Easy Install for Python, Maven for Java, and NPM for Node.js.

PEAR packages are very 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 that they’re installed on.

From the command-line, you can install the SDK with PEAR as follows:

pear channel-discover pear.amazonwebservices.com
pear install aws/sdk

You may need to use sudo for the above commands. Once the SDK has been installed via PEAR, you can load it into your project with:

require_once 'AWSSDKforPHP/sdk.class.php';

Via Composer

Composer is a newer dependency manager for PHP, and is now supported by the SDK.

In order to use the AWS SDK for PHP via Composer, you must do the following:

  1. Add amazonwebservices/aws-sdk-for-php as a dependency in your project’s composer.json file:

    {
        "require": {
            "amazonwebservices/aws-sdk-for-php": "*"
        }
    }
    

    Consider tightening your dependencies to a known version when deploying mission critical applications (e.g. 1.5.*).

  2. Download and install Composer:

    curl -s http://getcomposer.org/installer | php

  3. Install your dependencies:

    php composer.phar install

  4. Require Composer’s autoloader

    Composer also prepares an autoload file that’s capable of autoloading all of the classes in any of the libraries that it downloads. To use it, just add the following line to your code’s bootstrap process:

    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.

Configuration

  1. Copy the contents of config-sample.inc.php and add your credentials as instructed in the file.
  2. Move your file to ~/.aws/sdk/config.inc.php.
  3. Make sure that getenv('HOME') points to your user directory. If not you’ll need to set putenv('HOME=<your-user-directory>').

This is because PHP will attempt to load the file from your user directory (e.g., ~/.aws/sdk/config.inc.php). If PHP doesn’t happen to know where your user directory is, you’ll need to tell PHP where it is with the putenv() function.

Additional Information

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback