descom/aws-sns-notification
AWS SNS Notifications for Laravel Apps
Install
composer require descom/aws-sns-notification
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(),
]);
}
}
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
637,827,751
9,703
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
413,412,504
609
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
391,429,217
4,660