Skip to content

JoggApp/laravel-aws-sns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel package for the AWS SNS Events

Latest Version Total Downloads

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 [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see the License File for more information.