joggapp / laravel-aws-sns
Laravel package for the SNS events by AWS
Installs: 38 993
Dependents: 0
Suggesters: 0
Security: 0
Stars: 31
Watchers: 3
Forks: 3
Open Issues: 0
Requires
- php: ^8.2
- aws/aws-php-sns-message-validator: ^1.6
- illuminate/http: ^11.0
- illuminate/queue: ^11.0
- illuminate/support: ^11.0
README
Amazon Simple Notification Service (Amazon SNS) is a web service that coordinates and manages the delivery or sending of messages to subscribing endpoints or clients. The Amazon S3 notification feature enables you to receive notifications when certain events happen in your bucket.
This package ships with a controller that listens to the SNS notification incoming to one of your defined URL/endpoint. The controller takes care of validating the incoming request's signature & messages, confirming your endpoint's subscription to the SNS topic and also emits respective Laravel events. If you are using AWS SNS, all you have to do after installing this package is add your desired Laravel Listeners. The Listeners will automatically receive the SNS message. You are free to take control of the message after that to achieve your desired results.
Installation and Usage
- You can install this package via composer using this command:
composer require joggapp/laravel-aws-sns
-
The package will automatically register itself.
-
You then need to pass the route to
awsSnsWebhooks
:
Route::awsSnsWebhooks('route-you-added-in-aws-sns-topic-subscription-console');
-
The package emits 2 events:
SnsTopicSubscriptionConfirmed
&SnsMessageReceived
. -
SnsTopicSubscriptionConfirmed
: This event is fired once the endpoint's subscription to the SNS topic is confirmed. -
SnsMessageReceived
: This event is fired everytime your endpoint receives a message (request) from AWS SNS. -
To use these events you will have to add the events in your
app/Providers/EventServiceProvider.php
-
You can access the SNS message in your listeners listening to the
SnsMessageReceived
event just like you would do in any other laravel listener:
class SnsListener { public function handle($event) { $event->message } }
Changelog
Please see the CHANGELOG for more information about what has changed recently.
Security
If you discover any security related issues, please email them to harish@jogg.co instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see the License File for more information.