AWS (SDK)

AWS SDK

The AWS SDK for PHP Version 3 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, and S3 Glacier.

Requirements

To use the AWS SDK for PHP, you must be using PHP with the SimpleXML PHP extension enabled. If you need to sign private Amazon CloudFront URLs, you also need the OpenSSL PHP extension.

For more details, please see the official requirements and recommendations.

Installation

Add AWS SDK for PHP as a dependency via Composer

Using composer, run the following in the base directory of your project to install AWS SDK for PHP as a dependency:

composer require aws/aws-sdk-php

Configurations

# set the default region
AWS_REGION=ca-central-1

# set the aws version
AWS_VERSION=latest

# credentials
AWS_CREDENTIALS_KEY=<your_aws_key>
AWS_CREDENTIALS_SECRET=<your_aws_secret>

# define your own service provider
PROVIDER_COOKIES=\Zemit\Provider\Aws\ServiceProvider

Usage

// if the class is aware of injections
$aws = $this->aws;

// if the container is present
$aws = $this->di->get('aws');

// from outside
$aws = Di::getDefault()->get('aws');

API References

Sources

Last updated