PHP
How to use the PHP AWS SDK with LocalStack.
Overview
The AWS SDK for PHP, like other AWS SDKs, lets you set the endpoint when creating resource clients, which is the preferred way of integrating the PHP SDK with LocalStack.
Example
Here is an example of how to create an S3Client
with the endpoint set to LocalStack.
use Aws\S3\S3Client;
use Aws\Exception\AwsException;
// Configuring S3 Client
$s3 = new Aws\S3\S3Client([
'version' => '2006-03-01',
'region' => 'us-east-1',
// Enable 'use_path_style_endpoint' => true, if bucket name is non DNS compliant
'use_path_style_endpoint' => true,
'endpoint' => 'http://s3.localhost.localstack.cloud:4566',
]);
A full example can be found in our samples repository.
Resources
Last modified October 11, 2021: minor: rename folder Integrations->integrations (68c86019)
当前内容版权归 LocalStack 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 LocalStack .