PHPackages                             sinemacula/laravel-aws-sns-listener - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. sinemacula/laravel-aws-sns-listener

ActiveLibrary[API Development](/categories/api)

sinemacula/laravel-aws-sns-listener
===================================

Laravel package to handle AWS SNS notifications with seamless integration and event-driven architecture

v2.0.0(2mo ago)115.5k↓40%1[1 PRs](https://github.com/sinemacula/laravel-aws-sns-listener/pulls)Apache-2.0PHPPHP ^8.3CI passing

Since Aug 12Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/sinemacula/laravel-aws-sns-listener)[ Packagist](https://packagist.org/packages/sinemacula/laravel-aws-sns-listener)[ RSS](/packages/sinemacula-laravel-aws-sns-listener/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (17)Versions (10)Used By (0)

Laravel AWS SNS Listener
========================

[](#laravel-aws-sns-listener)

[![Latest Stable Version](https://camo.githubusercontent.com/06baa4bda46c745409a94961f0404080aea5ddeb8d9e2f9f13dd1bdebb9fd322/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696e656d6163756c612f6c61726176656c2d6177732d736e732d6c697374656e65722e737667)](https://packagist.org/packages/sinemacula/laravel-aws-sns-listener)[![Build Status](https://github.com/sinemacula/laravel-aws-sns-listener/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/sinemacula/laravel-aws-sns-listener/actions/workflows/tests.yml)[![Maintainability](https://camo.githubusercontent.com/c5700a8a70f2ee9178b988e7a381eae16609d5803e9b24fbb6bfbfa7686e4c36/68747470733a2f2f716c74792e73682f67682f73696e656d6163756c612f70726f6a656374732f6c61726176656c2d6177732d736e732d6c697374656e65722f6d61696e7461696e6162696c6974792e737667)](https://qlty.sh/gh/sinemacula/projects/laravel-aws-sns-listener)[![Code Coverage](https://camo.githubusercontent.com/0bcc63dc4786f8510dce167def053811bf90f48c9872f51ca1375f336249dea9/68747470733a2f2f716c74792e73682f67682f73696e656d6163756c612f70726f6a656374732f6c61726176656c2d6177732d736e732d6c697374656e65722f636f7665726167652e737667)](https://qlty.sh/gh/sinemacula/projects/laravel-aws-sns-listener)[![Total Downloads](https://camo.githubusercontent.com/2bc54ea807a47bfdb3ef4d0ffdb4ca58f6e6d1711e2a78d4e2be810b5fcce9a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696e656d6163756c612f6c61726176656c2d6177732d736e732d6c697374656e65722e737667)](https://packagist.org/packages/sinemacula/laravel-aws-sns-listener)

Laravel integration package for receiving AWS SNS webhooks with signature validation, typed payload mapping, and Laravel event dispatch.

What This Package Does
----------------------

[](#what-this-package-does)

- Registers an SNS webhook route in your Laravel app.
- Validates incoming SNS signatures with AWS certificates.
- Maps SNS payloads to typed message entities.
- Handles subscription confirmation for expected topics.
- Dispatches Laravel events for generic and provider-specific notifications.

Installation
------------

[](#installation)

```
composer require sinemacula/laravel-aws-sns-listener
```

The service provider is auto-discovered by Laravel.

Configuration
-------------

[](#configuration)

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.

Request Flow
------------

[](#request-flow)

1. SNS posts to the configured route.
2. `VerifySnsSignature` validates the message signature.
3. `MessageFactory` maps the payload to a typed message.
4. `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`.

Dispatched Events
-----------------

[](#dispatched-events)

- `SineMacula\Aws\Sns\Events\SubscriptionConfirmed`
- `SineMacula\Aws\Sns\Events\NotificationReceived`
- `SineMacula\Aws\Sns\Events\SNSNotificationReceived`
- `SineMacula\Aws\Sns\Events\S3NotificationReceived`
- `SineMacula\Aws\Sns\Events\SesNotificationReceived`
- `SineMacula\Aws\Sns\Events\CloudWatchNotificationReceived`

Each event carries a typed message object implementing the matching contract interface from `SineMacula\Aws\Sns\Entities\Messages\Contracts`.

Example Listener
----------------

[](#example-listener)

```
