git clone https://github.com/awslabs/aws-php-sample.git

From the aws-php-sample directory, run:

curl -sS https://getcomposer.org/installer | php

php composer.phar install

Create your credentials file at ~/.aws/credentials (C:\Users\USER_NAME\.aws\credentials for Windows users) and save the following lines after replacing the underlined values with your own.

[default]

aws_access_key_id = YOUR_ACCESS_KEY_ID

aws_secret_access_key = YOUR_SECRET_ACCESS_KEY

php sample.php

This sample application is designed to show you how to:

  • Declare a dependency on the AWS SDK for PHP using Composer.
  • Read access keys from environment variables.
  • Instantiate an Amazon Simple Storage Service (Amazon S3) client.
  • Interact with Amazon S3 in various ways, such as creating a bucket and uploading a file.

The project's README file contains more information about this sample code. If you have trouble getting set up or have other feedback about this sample, let us know on GitHub.

For in-depth user guides, API documentation, developer forums, and other developer resources, see the AWS SDK for PHP page.