onethirtyone / aws-sns-handler
Laravel package to handle incoming SNS messages
Requires
- aws/aws-php-sns-message-validator: ^1.5
- illuminate/support: ~7.4.0
Requires (Dev)
- guzzlehttp/guzzle: ^6.5
- orchestra/testbench: ^5.1
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2025-03-01 00:24:14 UTC
README
This is a Laravel package for validating and handling AWS SNS messages
Installation
You can install the package with composer
composer require onethirtyone/aws-sns-handler
CSRF
Since SNS messages are sent via a HTTP Post Request you will need to add your webhook route to your VerifyCsrfToken.php
/** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ '/webhook' ];
Usage
Edit your routes/web.php
and add a route to your the webhook handler
Route::any('callback', 'OneThirtyOne\Sns\Controllers\SnsController@handle');
Events
The package will fire an SnsSubscriptionConfirmation
event when a new subscription is added and needs to be confirmed and will fire an SnsEvent
event when a message is delivered after confirmation.
You should listen for these events in your application.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change