Download the PHP package onsetsoftware/sns-push without Composer
On this page you can find all versions of the php package onsetsoftware/sns-push. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download onsetsoftware/sns-push
More information about onsetsoftware/sns-push
Files in onsetsoftware/sns-push
Package sns-push
Short Description Platform agnostic API Wrapper for Amazon SNS
License MIT
Homepage https://github.com/onsetsoftware/sns-push
Informations about the package sns-push
SNS Push (for AWS SNS API)
This package provides helper methods to send mobile push notifications with the Amazon (AWS) SNS API.
SNS Push is a simple SNS SDK wrapper with a collection of methods to aid in interacting with the AWS SNS API. It works directly with Laravel or can be used as a standalone PHP package.
Prerequisites
Supports | Version |
---|---|
PHP | 7.2 |
Platforms | ios/android |
Installing
You need to use Composer to install SNS Push into your project:
Other PHP Framework (not Laravel) Setup
You should include the Composer autoload.php
file if not already loaded:
Instantiate the SNSPush class with the following required config values:
- account_id
- access_key
- secret_key
- platform_applications
Also configurable:
- region [default: eu-west-1]
- api_version [default: 2010-03-31]
- scheme [default: https]
Laravel Service Provider
If you are a Laravel user, you can make use of the included service provider. Just add SNSPushServiceProvider
in your config/app.php
:
Add 'sns' config keys to the config/services.php
Add Device to Application
Add a device to a platform application (ios/android) by passing the device token and application key to addDevice()
.
Remove Device from Application
Remove a device from AWS SNS by passing the Endpoint ARN to removeDevice()
.
Subscribe Device to Topic
Subscribe a device to a Topic by passing the Endpoint Arn and Topic Arn to subscribeDeviceToTopic()
.
Remove Device from Topic
Remove a device from a Topic by passing the Subscription Arn to removeDeviceFromTopic()
.
Sending Push Notifications
SNS Push supports sending notifications to both Topic Endpoint or directly to an Endpoint ARN (Device).
Messages
Messages must implement SNSPush\Messages\MessageInterface
. There are a number of utility classes which format push notifications correctly for the various endpoint types.
Phonegap Plugin Push
The package includes two classes to help format messages for use with the Phonegap Plugin Push Cordova package.
For the full api, please consult the source of each of the message types
Send to Device
Simply pass an object implementing SNSPush\Messages\MessageInterface
, along with the endpoint ARN. The Endpoint platform must match the message type.
Send to Topic
First you should form your SNSPush\Messages\TopicMessage
by passing an array of the Message objects for the enpoints you need to address. Then pass the TopicMessage
to the sendPushNotificationToTopic
method.
Thanks
This package builds on the work done by ReduGroup.
Licence
MIT License © On Set Software Ltd
All versions of sns-push with dependencies
aws/aws-sdk-php Version ^3.36
aws/aws-php-sns-message-validator Version ^1.4
ext-ctype Version *
ext-mbstring Version *
ext-json Version *