PHP code example of chrisbarr / amazon-sns-php-api

1. Go to this page and download the library: Download chrisbarr/amazon-sns-php-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chrisbarr / amazon-sns-php-api example snippets



reate an instance
$AmazonSNS = new AmazonSNS(AMAZON_ACCESS_KEY_ID, AMAZON_SECRET_ACCESS_KEY);

// Create a Topic
$topicArn = $AmazonSNS->createTopic('My New SNS Topic');

// Set the Topic's Display Name (scribers of this topic
$AmazonSNS->publish($topicArn, 'Hello, world!');


zonSNS = new AmazonSNS(AMAZON_ACCESS_KEY_ID, AMAZON_SECRET_ACCESS_KEY);
$AmazonSNS->setRegion('eu-west-1');

try {
	$topics = $AmazonSNS->listTopics();
}
catch(SNSException $e) {
	// Amazon SNS returned an error
	echo 'SNS returned the error "' . $e->getMessage() . '" and code ' . $e->getCode();
}
catch(APIException $e) {
	// Problem with the API
	echo 'There was an unknown problem with the API, returned code ' . $e->getCode();
}

$ composer