briareos/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

v3.0.1 2015-03-27 12:44 UTC

This package is not auto-updated.

Last update: 2019-12-13 14:37:08 UTC


README

Latest Stable Version Total Downloads Build Status ![Gitter](https://badges.gitter.im/Join Chat.svg)

The AWS SDK for PHP enables PHP developers to use Amazon Web Services in their PHP code, and build robust applications and software using services like Amazon S3, Amazon DynamoDB, Amazon Glacier, etc. You can get started in minutes by installing the SDK through Composer or by downloading a single zip or phar file from our latest release.

Resources

  • User Guide – For in-depth getting started and usage information
  • API Docs – For operations, parameters, responses, and examples
  • Blog – Tips & tricks, articles, and announcements
  • Sample Project - A quick, sample project to help get you started
  • Forum – Ask questions, get help, and give feedback
  • Issues – Report issues and submit pull requests (see Apache 2.0 License)
  • @awsforphp – Follow us on Twitter

Installing

The recommended way to install the AWS SDK for PHP is through Composer.

  1. Install Composer:

     curl -sS https://getcomposer.org/installer | php
    
  2. Next, run the Composer command to install the latest stable version of the AWS SDK for PHP:

     composer require aws/aws-sdk-php
    
  3. After installing, you need to require Composer's autoloader in your app:

     require 'vendor/autoload.php';
    

More installation instructions can be found in the User Guide.

Features

Getting Started

  1. Sign up for AWS – Before you begin, you need to sign up for an AWS account and retrieve your AWS credentials.
  2. Minimum requirements – To run the SDK, your system will need to meet the minimum requirements, including having PHP >= 5.5.0 compiled with the cURL extension and cURL 7.16.2+ compiled with a TLS backend (e.g., NSS or OpenSSL).
  3. Install the SDK – Using Composer is the recommended way to install the AWS SDK for PHP. The SDK is available via Packagist under the aws/aws-sdk-php package. Please see the Installation section of the User Guide for more detailed information about installing the SDK through Composer and other means.
  4. Using the SDK – The best way to become familiar with how to use the SDK is to read the User Guide. The Getting Started Guide will help you become familiar with the basic concepts, and there are also specific guides for each of the supported services.

Quick Examples

Create an Amazon S3 client

<?php
// Require the Composer autoloader.
require 'vendor/autoload.php';

use Aws\S3\S3Client;
use Aws\Exception\S3Exception;

// Instantiate an Amazon S3 client.
$s3 = new S3Client([
    'version' => 'latest',
    'region'  => 'us-west-2'
]);

Upload a file to Amazon S3

<?php
// Upload a publicly accessible file. The file size, file type, and MD5 hash
// are automatically calculated by the SDK.
try {
    $s3->putObject([
        'Bucket' => 'my-bucket',
        'Key'    => 'my-object',
        'Body'   => fopen('/path/to/file', 'r'),
        'ACL'    => 'public-read',
    ]);
} catch (S3Exception $e) {
    echo "There was an error uploading the file.\n";
}

Related Projects