Giter VIP home page Giter VIP logo

aws-sdk-php's Introduction

AWS SDK for PHP

Latest Stable Version Total Downloads Build Status

The AWS SDK for PHP enables PHP developers to easily work with Amazon Web Services and build scalable solutions with Amazon S3, Amazon DynamoDB, Amazon Glacier, and more. You can get started in minutes by installing the SDK through Composer or by downloading a single zip or phar file.

Features

  • Provides easy-to-use HTTP clients for all supported AWS services, regions, and authentication protocols.
  • Built for PHP 5.3.3+ and is compliant with PSR-0, PSR-1, and PSR-2.
  • Easy to install through Composer, PEAR, or single download (zip or phar).
  • Built on Guzzle and utilizes many of its features including persistent connections, parallel requests, events and plugins (via Symfony2 EventDispatcher), service descriptions, over-the-wire logging, caching, flexible batching, and request retrying with truncated exponential backoff.
  • Convenience features including Iterators, Waiters, and modelled responses.
  • Upload directories to and download directories from Amazon S3.
  • Multipart uploader for Amazon S3 and Amazon Glacier that can be paused and resumed.
  • DynamoDB Session Handler for easily scaling sessions.
  • Automatically uses IAM Instance Profile Credentials on configured Amazon EC2 instances.

Getting Started

  1. Sign up for AWS – Before you begin, you need an AWS account. Please see the Signing Up for AWS section of the user guide for information about how to create an AWS account and retrieve your AWS credentials.
  2. Minimum requirements – To run the SDK you will need PHP 5.3.3+ compiled with the cURL extension and cURL 7.16.2+ compiled with OpenSSL and zlib. For more information about the requirements and optimum settings for the SDK, please see the Requirements section of the user guide.
  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 (e.g., Phar, Zip, PEAR).
  4. Using the SDK – The best way to become familiar with how to use the SDK is to read the User Guide. The Quick Start Guide will help you become familiar with the basic concepts, and there are also specific guides for each of the supported services.

Quick Example

Upload a File to Amazon S3

<?php

require 'vendor/autoload.php';

use Aws\Common\Aws;
use Aws\S3\Exception\S3Exception;

// Instantiate an S3 client
$s3 = Aws::factory('/path/to/config.php')->get('s3');

// Upload a publicly accessible file. The file size, file type, and MD5 hash are automatically calculated by the SDK
try {
    $s3->putObject(array(
        '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";
}

You can also use the even easier upload method.

try {
    $s3->upload('my-bucket', 'my-object', fopen('/path/to/file', 'r'), 'public-read');
} catch (S3Exception $e) {
    echo "There was an error uploading the file.\n";
}

More Examples

aws-sdk-php's People

Contributors

adrienbrault avatar brendandixon avatar buley avatar carljparker avatar datibbaw avatar davedevelopment avatar eugenebond avatar hidehara avatar jeremeamia avatar mtdowling avatar pborreli avatar pcolby avatar poisa avatar rcambien avatar rlerdorf avatar skyzyx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.