- Sign up for AWS – Before you begin, you need to sign up for an AWS account and retrieve your AWS credentials.
- Minimum requirements – To run the SDK, your system will need to meet the minimum requirements, including having PHP >= 8.1. We highly recommend having it compiled with the cURL extension and cURL 7.16.2+ compiled with a TLS backend (e.g., NSS or OpenSSL).
- 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-phppackage. If Composer is installed globally on your system, you can run the following in the base directory of your project to add the SDK as a dependency:composer require aws/aws-sdk-phpPlease see the Installation section of the User Guide for more detailed information about installing the SDK through Composer and other means. - 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.
- Removing unused services — To date, there are over 400 AWS services available for use with this SDK. You will likely not need them all. If you use Composer and would like to learn more about this feature, please read the linked documentation.
Quick Examples
Create an Amazon S3 client
<?php
// Require the Composer autoloader.
require 'vendor/autoload.php';
use Aws\S3\S3Client;
// 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 and type are determined by the SDK.
try {
$s3->putObject([
'Bucket' => 'my-bucket',
'Key' => 'my-object',
'Body' => fopen('/path/to/file', 'r'),
'ACL' => 'public-read',
]);
} catch (Aws\S3\Exception\S3Exception $e) {
echo "There was an error uploading the file.\n";
}
Getting Help
Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.
- Ask a question on StackOverflow and tag it with
aws-php-sdk - Come join the AWS SDK for PHP gitter
- Open a support ticket with AWS Support
- If it turns out that you may have found a bug, please open an issue
This SDK implements AWS service APIs. For general issues regarding the AWS services and their limitations, you may also take a look at the Amazon Web Services Discussion Forums.
Maintenance and support for SDK major versions
For information about maintenance and support for SDK major versions and their underlying dependencies, see the following in the AWS SDKs and Tools Shared Configuration and Credentials Reference Guide:
