Laravel SNS Events Package
Published on by Paul Redmond
Laravel SNS Events is a package by rennokki that allows you to listen to Amazon Simple Notification Service (SNS) webhooks via Laravel Events. It implements a controller that is made to properly listen to SNS HTTPS webhooks and trigger events on which you can listen to in Laravel:
Route::any('/aws/sns', 'Rennokki\LaravelSnsEvents\Http\Controllers\SnsController@handle');
Then you process events by registering listeners in your app’s EventServiceProvider class:
protected $listen = [ ... SnsEvent::class => [ // add your listeners here for SNS events ], SnsSubscriptionConfirmation::class => [ // add your listeners here in case you want to listen to subscription confirmation ],];
If you are not familiar with SNS, Amazon describes on the SNS product page as follows:
Amazon Simple Notification Service (SNS) is a highly available, durable, secure, fully managed pub/sub messaging service that enables you to decouple microservices, distributed systems, and serverless applications. Amazon SNS provides topics for high-throughput, push-based, many-to-many messaging. Using Amazon SNS topics, your publisher systems can fan out messages to a large number of subscriber endpoints for parallel processing, including Amazon SQS queues, AWS Lambda functions, and HTTP/S webhooks.
To learn more about the full capabilities of this package, including source code, documentation, and examples, check out the project on GitHub at rennokki/laravel-sns-events.
Related: rennokki is the author of Laravel Befriended, a package which brings social media-like features like following, blocking and filtering content based on following or blocked models.