PHPackages                             trunk-studio/aws-sns-laravel-notification - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. trunk-studio/aws-sns-laravel-notification

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

trunk-studio/aws-sns-laravel-notification
=========================================

aws-sns-laravel-notification

1.0.1(5y ago)0325MITPHPPHP &gt;=7.2

Since Oct 13Pushed 4y agoCompare

[ Source](https://github.com/trunk-studio/aws-sns-laravel-notification)[ Packagist](https://packagist.org/packages/trunk-studio/aws-sns-laravel-notification)[ Docs](https://github.com/trunk-studio/aws-sns-laravel-notification)[ RSS](/packages/trunk-studio-aws-sns-laravel-notification/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (5)Used By (0)

aws sns laravel notification
============================

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

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

Install this package with Composer:

`composer require laravel-notification-channels/aws-sns`

After installing the package, register the ServiceProvider with your config/app.php.

`NotificationChannels\AwsSns\SNSServiceProvider::class`

### Setting up the AWS SNS service

[](#setting-up-the-aws-sns-service)

You will need to obtain required API access key and secret key from AWS console. Also, you need to define the region that you are using for SNS.

```
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_REGION (default = us-east-1)

```

If you need to override other settings for AWS API access, please refer to configuration section of official AWS PHP Laravel Service Provider which this package depends on.

Usage
-----

[](#usage)

In order to send notifications via SNS, you need to create a notification class. If you want to send message to a specific endpoint, you need to provide TargetArn. If you want to send to a topic, then provide TopicArn. A simple example is as follow:

```
use Illuminate\Notifications\Notification;
use NotificationChannels\AwsSns\SNSMessage;
use NotificationChannels\AwsSns\SNSChannel;
use NotificationChannels\AwsSns\Notifications\APNS;
use NotificationChannels\AwsSns\Notifications\GCM;
use NotificationChannels\AwsSns\Notifications\SMS;

class AccountApproved extends Notification
{

    public function via($notifiable)
    {
        return [SNSChannel::class];
    }

    public function toSNS($notifiable)
    {

        return (new SNSMessage)
                    ->message('This is a simple message')
                    ->subject('This is subject')
                    ->topicArn('');
    }
}

```

SNS support custom messages for specific endpoints. Therefore, you can setup a custom message for various platforms. For instance, you can configure a custom GCM push notification that will be send to the subscribers of the topic that are registered via GCM. Currently, APNS, GCM, and SMS are implemented. Other endpoints that are supported by AWS will be added later.

```
public function toSNS($notifiable)
{
    return (new SNSMessage())
                ->message('This is a custom message')
                ->subject('This is subject')
                ->messageStructure('json')
                ->topicArn('')
                ->apnsMessage((new APNS)
                                ->message('APNS custom message')
                                ->badge(2)
                                ->sound('sound.mp3')
                                ->addCustomPayload('custom1', 'test value 1')
                                ->addCustomPayload('custom2', 'test value 2'))
                ->gcmMessage((new GCM)
                                ->message('GCM custom message'))
                ->smsMessage(new SMS('SMS custom message'));
}

```

### Available Message methods

[](#available-message-methods)

##### Methods of generic SNS notifications

[](#methods-of-generic-sns-notifications)

- `subeject()`: Subject of the notification.
- `message()`: Default message of the notification.
- `topicArn()`: Topic that notification will be send to.
- `targetArn()`: A specific target ARN, if you want to send notification to a specific subscriber.
- `messageStructure()`: If you want to use custom notifications for different endpoints, then you need to set message structure to `'json'`
- `messageAttributes()`: Custom attributes supported by AWS SNS.
- `phoneNumber()`: If you want to send SMS, set phone number.
- `apnsMessage()`: Custom APNS message.
- `gcmMessage()`: Custom GCM message.
- `smsMessage()`: Custom SMS message.

##### Methods of APNS notifications

[](#methods-of-apns-notifications)

- `message()`: APNS custom message.
- `badge()`: App icon badge count.
- `sound()`: Alert message sound.
- `addCustomPayload()`: Custom payload for notification.

##### Methods of GCM notifications

[](#methods-of-gcm-notifications)

- `message()`: GCM custom message.
- `data()`: Data payload.
- `notification()`: Notification payload.
- `priority()`: Notification priority.
- `collapseKey()`: Notification collapse key.
- `timeToLive()`: Notification time to live duration.

##### Methods of SMS notifications

[](#methods-of-sms-notifications)

- `message()`: SMS custom message.

For further details of each method, please refer to SNS PHP SDK.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Trunk Studio](https://github.com/trunk-studio)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor4

4 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~145 days

Total

2

Last Release

1943d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/28592908?v=4)[trunksys](/maintainers/trunksys)[@trunksys](https://github.com/trunksys)

---

Top Contributors

[![atymic](https://avatars.githubusercontent.com/u/50683531?v=4)](https://github.com/atymic "atymic (11 commits)")[![kyle-consult](https://avatars.githubusercontent.com/u/14325987?v=4)](https://github.com/kyle-consult "kyle-consult (7 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (7 commits)")[![iamcxa](https://avatars.githubusercontent.com/u/1522808?v=4)](https://github.com/iamcxa "iamcxa (7 commits)")[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (7 commits)")[![irazasyed](https://avatars.githubusercontent.com/u/1915268?v=4)](https://github.com/irazasyed "irazasyed (6 commits)")[![themsaid](https://avatars.githubusercontent.com/u/4332182?v=4)](https://github.com/themsaid "themsaid (4 commits)")[![lukewaite](https://avatars.githubusercontent.com/u/618130?v=4)](https://github.com/lukewaite "lukewaite (2 commits)")[![smlsunxie](https://avatars.githubusercontent.com/u/1689227?v=4)](https://github.com/smlsunxie "smlsunxie (2 commits)")[![casperboone](https://avatars.githubusercontent.com/u/15815208?v=4)](https://github.com/casperboone "casperboone (2 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (1 commits)")[![jasperdyb](https://avatars.githubusercontent.com/u/16401556?v=4)](https://github.com/jasperdyb "jasperdyb (1 commits)")[![talvbansal](https://avatars.githubusercontent.com/u/7305131?v=4)](https://github.com/talvbansal "talvbansal (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/trunk-studio-aws-sns-laravel-notification/health.svg)

```
[![Health](https://phpackages.com/badges/trunk-studio-aws-sns-laravel-notification/health.svg)](https://phpackages.com/packages/trunk-studio-aws-sns-laravel-notification)
```

###  Alternatives

[laravel-notification-channels/webpush

Web Push Notifications driver for Laravel.

9005.5M27](/packages/laravel-notification-channels-webpush)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M164](/packages/spatie-laravel-health)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2022.2M8](/packages/laravel-notification-channels-apn)[illuminate/mail

The Illuminate Mail package.

5910.6M499](/packages/illuminate-mail)[laravel-notification-channels/expo

Expo Notifications Channel for Laravel

67628.6k1](/packages/laravel-notification-channels-expo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
