2017 © Pedro Peláez
 

library amazon-sns-php-api

Amazon SNS PHP API

image

chrisbarr/amazon-sns-php-api

Amazon SNS PHP API

  • Wednesday, April 4, 2018
  • by chrisbarr
  • Repository
  • 13 Watchers
  • 57 Stars
  • 14,087 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 24 Forks
  • 0 Open issues
  • 15 Versions
  • 7 % Grown

The README.md

Amazon SNS PHP API

Latest Stable Version PHP from Packagist, (*1)

This API wrapper is a lightweight alternative to the official Amazon aws-sdk-for-php for access to Amazon SNS (Simple Notification Service) using PHP, (*2)

Find out more about Amazon SNS here - http://aws.amazon.com/sns, (*3)

To use this wrapper you must be using PHP5 with cURL, and have an Amazon AWS account, (*4)

Basic Use

Install using Composer on the command line:, (*5)

$ composer require chrisbarr/amazon-sns-php-api

Or add it to your composer.json file:, (*6)

{
    ...
    "require": {
        "chrisbarr/amazon-sns-php-api": "~1.0"
    }
}

Example usage:, (*7)

<?php
require 'vendor/autoload.php';

// Create 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 (required)
$AmazonSNS->setTopicAttributes($topicArn, 'DisplayName', 'My SNS Topic Display Name');

// Subscribe to this topic
$AmazonSNS->subscribe($topicArn, 'email', 'example@github.com');

// And send a message to subscribers of this topic
$AmazonSNS->publish($topicArn, 'Hello, world!');

API Methods

Available methods:, (*8)

  • addPermission($topicArn, $label, $permissions)
  • confirmSubscription($topicArn, $token)
  • createTopic($name)
  • deleteTopic($topicArn)
  • getTopicAttributes($topicArn)
  • listSubscriptions()
  • listSubscriptionsByTopic($topicArn)
  • listTopics()
  • publish($topicArn, $message, $subject, $messageStructure)
  • removePermission($topicArn, $label)
  • setTopicAttributes($topicArn, $attrName, $attrValue)
  • subscribe($topicArn, $protocol, $endpoint)
  • unsubscribe($subscriptionArn)
  • createPlatformEndpoint($platformApplicationArn, $token, $userData)
  • deleteEndpoint($deviceArn)
  • publishToEndpoint($deviceArn,$message)

To set the API region (us-east-1, us-west-2, us-west-1, eu-west-1, etc):, (*9)

  • setRegion($region)

The default API region is us-east-1, (*10)

Further Example

Make sure to catch Exceptions where necessary:, (*11)

<?php
require 'vendor/autoload.php';

$AmazonSNS = 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();
}

The Versions

04/04 2018

dev-master

9999999-dev https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

amazon aws sns

04/04 2018

1.8.0

1.8.0.0 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

amazon aws sns

08/03 2018

dev-manual-endpoint

dev-manual-endpoint https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

21/06 2017

1.7.0

1.7.0.0 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

06/04 2017

1.6.0

1.6.0.0 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

26/03 2017

dev-14-return-nextToken

dev-14-return-nextToken https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

18/08 2016

1.5.0

1.5.0.0 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

11/07 2016

dev-9-include-cacert

dev-9-include-cacert https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

24/06 2016

1.4.0

1.4.0.0 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

31/05 2016

1.3.0

1.3.0.0 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

10/02 2016

1.2.0

1.2.0.0 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

10/02 2016

dev-rohit-wadhwa-patch-1

dev-rohit-wadhwa-patch-1 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

01/11 2015

1.1.1

1.1.1.0 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

05/03 2015

1.1.0

1.1.0.0 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr

05/03 2015

1.0.0

1.0.0.0 https://github.com/chrisbarr/AmazonSNS-PHP-API

Amazon SNS PHP API

  Sources   Download

MIT

The Requires

  • php >=5.2

 

by Chris Barr