Download the PHP package trunk-studio/aws-sns-laravel-notification without Composer
On this page you can find all versions of the php package trunk-studio/aws-sns-laravel-notification. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download trunk-studio/aws-sns-laravel-notification
More information about trunk-studio/aws-sns-laravel-notification
Files in trunk-studio/aws-sns-laravel-notification
Package aws-sns-laravel-notification
Short Description aws-sns-laravel-notification
License MIT
Homepage https://github.com/trunk-studio/aws-sns-laravel-notification
Informations about the package aws-sns-laravel-notification
aws sns laravel notification
Contents
- Installation
- Usage
- Changelog
- Testing
- Security
- Contributing
- Credits
- License
Installation
Install this package with Composer:
composer require laravel-notification-channels/aws-sns
After installing the package, register the ServiceProvider with your config/app.php.
NotificationChannels\AwsSns\SNSServiceProvider::class
Setting up the AWS SNS service
You will need to obtain required API access key and secret key from AWS console. Also, you need to define the region that you are using for SNS.
If you need to override other settings for AWS API access, please refer to configuration section of official AWS PHP Laravel Service Provider which this package depends on.
Usage
In order to send notifications via SNS, you need to create a notification class. If you want to send message to a specific endpoint, you need to provide TargetArn. If you want to send to a topic, then provide TopicArn. A simple example is as follow:
SNS support custom messages for specific endpoints. Therefore, you can setup a custom message for various platforms. For instance, you can configure a custom GCM push notification that will be send to the subscribers of the topic that are registered via GCM. Currently, APNS, GCM, and SMS are implemented. Other endpoints that are supported by AWS will be added later.
Available Message methods
Methods of generic SNS notifications
subeject()
: Subject of the notification.message()
: Default message of the notification.topicArn()
: Topic that notification will be send to.targetArn()
: A specific target ARN, if you want to send notification to a specific subscriber.messageStructure()
: If you want to use custom notifications for different endpoints, then you need to set message structure to'json'
messageAttributes()
: Custom attributes supported by AWS SNS.phoneNumber()
: If you want to send SMS, set phone number.apnsMessage()
: Custom APNS message.gcmMessage()
: Custom GCM message.smsMessage()
: Custom SMS message.
Methods of APNS notifications
message()
: APNS custom message.badge()
: App icon badge count.sound()
: Alert message sound.addCustomPayload()
: Custom payload for notification.
Methods of GCM notifications
message()
: GCM custom message.data()
: Data payload.notification()
: Notification payload.priority()
: Notification priority.collapseKey()
: Notification collapse key.timeToLive()
: Notification time to live duration.
Methods of SMS notifications
message()
: SMS custom message.
For further details of each method, please refer to SNS PHP SDK.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
- Trunk Studio
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of aws-sns-laravel-notification with dependencies
illuminate/notifications Version ~6.0 || ~7.0 || ~8.0
illuminate/support Version ~6.0 || ~7.0 || ~8.0