Admiral-Piett / goaws

AWS (SQS/SNS) Clone for Development testing
MIT License
788 stars 146 forks source link

How to set endpoint for local development using AWS SNS? #271

Closed kafkadev111 closed 1 year ago

kafkadev111 commented 1 year ago

I use a library aws-sdk/client-s3 and mock for AWS sqs and sns: github Admiral-Piett/goaws

`require 'vendor/autoload.php';

use Aws\Exception\AwsException;

$endpointSite = 'http://localhost:4100/';

$client = new \Aws\Sns\SnsClient(['profile' => 'default','region' => 'us-east-1','version' => '2010-03-31']);

$topicName = 'refer'; $result = $client->createTopic(['Name' => $topicName,]);`

For SQS i use such code with Queue url and it works for me: $queueUrl = 'http://localhost:4100/100010001000/refer'; 'QueueUrl' $queueUrl,

How to set endpoint using SNS? Could you write some example

I am expecting send a request to local AWS mock URL: http://localhost:4100

kafkadev111 commented 1 year ago

Solution: $endpointSite = 'http://localhost:4100/';

$client = new \Aws\Sns\SnsClient([ 'profile' => 'default', 'region' => 'us-east-1', 'version' => '2010-03-31', 'endpoint' => $endpointSite, ]);