Laravel package to handle AWS SNS notifications with seamless integration and event-driven architecture
sinemacula/laravel-aws-sns-listener is a Laravel package for laravel package to handle aws sns notifications with seamless integration and event-driven architecture.
It currently has 1 GitHub stars and 19.097 downloads on Packagist (latest version v2.0.1).
Install it with composer require sinemacula/laravel-aws-sns-listener.
Discover more Laravel packages by sinemacula
or browse all Laravel packages to compare alternatives.
Last updated
Laravel integration package for receiving AWS SNS webhooks with signature validation, typed payload mapping, and Laravel event dispatch.
composer require sinemacula/laravel-aws-sns-listener
The service provider is auto-discovered by Laravel.
Publish the config file:
php artisan vendor:publish --provider="SineMacula\Aws\Sns\SnsServiceProvider"
Key options (config/aws.php):
aws.sns.route: webhook path for SNS callbacks (default: /hooks/sns).aws.sns.topics: expected topic ARNs for subscription confirmation checks.Environment examples:
AWS_SNS_ROUTE=/hooks/sns
AWS_SNS_TOPICS=arn:aws:sns:eu-west-1:123456789012:orders,arn:aws:sns:eu-west-1:123456789012:alerts
To disable auto route registration, set aws.sns.route to false in config.
VerifySnsSignature validates the message signature.MessageFactory maps the payload to a typed message.SnsController handles the message and dispatches events.For SubscriptionConfirmation, the package confirms the subscription URL only when the topic is registered in
aws.sns.topics.
SineMacula\Aws\Sns\Events\SubscriptionConfirmedSineMacula\Aws\Sns\Events\NotificationReceivedSineMacula\Aws\Sns\Events\SNSNotificationReceivedSineMacula\Aws\Sns\Events\S3NotificationReceivedSineMacula\Aws\Sns\Events\SesNotificationReceivedSineMacula\Aws\Sns\Events\CloudWatchNotificationReceivedEach event carries a typed message object implementing the matching contract interface from
SineMacula\Aws\Sns\Entities\Messages\Contracts.
<?php
namespace App\Listeners;
use SineMacula\Aws\Sns\Events\S3NotificationReceived;
final class HandleS3Notification
{
public function handle(S3NotificationReceived $event): void
{
foreach ($event->getNotification()->getRecords() as $record) {
// Process each S3 record.
}
}
}
composer test
composer test-coverage
composer check
Contributions are welcome via GitHub pull requests.
If you discover a security issue, please contact Sine Macula directly rather than opening a public issue.
Licensed under the Apache License, Version 2.0.