descom / aws-sns-notification
Package to Laravel to received notification from AWS SNS
Installs: 1 624
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- aws/aws-php-sns-message-validator: ^1.1
- illuminate/config: ^9.0|^10.0|^11.0
- illuminate/http: ^9.0|^10.0|^11.0
- illuminate/routing: ^9.0|^10.0|^11.0
- illuminate/support: ^9.0|^10.0|^11.0
Requires (Dev)
- descom/dev: ^1.0
- friendsofphp/php-cs-fixer: ^3.4
- nunomaduro/larastan: ^2.0
- orchestra/testbench: ^7.5|^8.0|^9.0
- phpstan/phpstan: ^1.2
- phpunit/phpunit: ^9.3|^10.0|^10.5
This package is auto-updated.
Last update: 2024-10-18 16:00:58 UTC
README
Install
composer require descom/aws-sns-notifications
Usage
Create en SNS a subscription HTTPS to a topic
https://localhost:8000/aws/sns/webhook
Capture Events
TopicSubscriptionRequest
use Descom\AwsSnsNotification\Events\TopicSubscriptionRequest; use Illuminate\Support\Facades\Http; class SnsSubscriptionConfirmation { public function handle(TopicSubscriptionRequest $event): void { logger()->info('SNS subscription request', [ 'topic' => $event->topicArn(), ]); // Confirm the subscription by sending a GET request to the SubscribeURL Http::get($event->subscribeUrl()); } }
TopicNotification
use Descom\AwsSnsNotification\Events\TopicNotification; use Illuminate\Support\Facades\Http; class SnsNotificationLogger { public function handle(TopicNotification $event): void { logger()->info('SNS Notification received', [ 'topic' => $event->topicArn(), 'subject' => $event->subject(), 'message' => $event->toJson(), ]); } }