PHPackages                             andreshg112/aws-sns - 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. andreshg112/aws-sns

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

andreshg112/aws-sns
===================

Amazon SNS Notifications Channel for Laravel 6

v1.0.2(2y ago)271MITPHPPHP &gt;=5.6.4

Since Sep 25Pushed 2y agoCompare

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

READMEChangelog (2)Dependencies (5)Versions (4)Used By (1)

Amazon SNS Notifications Channel for Laravel 6
==============================================

[](#amazon-sns-notifications-channel-for-laravel-6)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7be01837e22a225f98b1e6cc91babb0bf86f690a85ad50d9181c485c034b13fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61623132332f6177732d736e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lab123/aws-sns)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b124d1d282e4dea37bacf3261fd81f44ea6476fbe22477dbafa16e417f94ddfd/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c61623132332f6177732d736e732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/lab123/aws-sns)[![Quality Score](https://camo.githubusercontent.com/45464804e527d58fe36023d9947c215d20bd84a9007846330e5f044615e1442b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c61623132332f6177732d736e732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/lab123/aws-sns)[![Code Coverage](https://camo.githubusercontent.com/00dab0dfcdcfff141c2c7b262f0ea38a04c787a126e3dc2c9567788054f96381/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c61623132332f6177732d736e732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/lab123/aws-sns/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/a482a7eb976ce6268feb5334eb8d1264d9c247b24a097a9764491c8d5abe9a10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61623132332f6177732d736e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lab123/aws-sns)

This package makes it easy to send notifications using [Amazon SNS](https://aws.amazon.com/pt/sns/) with Laravel 5.3.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up the AwsSns service](#setting-up-the-awssns-service)
- [Usage](#usage)
    - [Sending SMS](#sending-sms)
    - [Sending Topic](#sending-topic)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

Can to install with commands:

```
composer require lab123/aws-sns:dev-master

```

Or editing the `composer.json` file:

```
"require": {
	"lab123/aws-sns": "dev-master"
}

```

You must install the service provider.

**Laravel 5.x**

configure in `config/app.php`:

```
'providers' => [
    ...
    Lab123\AwsSns\AwsSnsServiceProvider::class,
]

```

**Lumen 5.x**

configure in `bootstrap/app.php`:

```
$app->register(\Lab123\AwsSns\AwsSnsLumenServiceProvider::class);

```

\*\* Note: \*\* You go need make a wrapper [Laravel Notification](https://laracasts.com/discuss/channels/lumen/notification-in-lumen-53 "Laravel Notification") or use a package how [Lumen Notification](https://packagist.org/packages/lab123/lumen-notification "Lumen Notification")

### Setting up the AwsSns service

[](#setting-up-the-awssns-service)

Follow the Amazon Console generate the APIKEY and API SECRET, which is connecting both.

Create a new sns section inside `config/services.php`:

```
...
'sns' => [
    'key' => env('SNS_KEY'),
    'secret' => env('SNS_SECRET'),
    'region' => env('SNS_REGION', 'us-east-1')
],
...

```

Next we need to add this keys to our Laravel environment. Edit file `.env` to config the keys:

```
...
SNS_KEY=YOUR_KEY
SNS_SECRET=YOUR_SECRET
SNS_REGION=YOUR_REGION
...

```

### Default Configurations SMS (OPTIONAL)

[](#default-configurations-sms-optional)

You also can config defaults attributes for sending SMS running `php artisan vendor:publish --provider="Lab123\AwsSns\AwsSnsServiceProvider"` or creating file `config/aws-sns.php`:

```
return [

    'sms' => [
        'monthlySpendLimit' => env('SNS_SMS_MONTHLY_LIMIT'),
        'deliveryStatusIAMRole' => env('SNS_SMS_DELIVERY_STATUS_IAM_ROLE'),
        'deliveryStatusSuccessSamplingRate' => env('SNS_SMS_DELIVERY_STATUS'),
        'defaultSenderID' => env('SNS_SMS_SENDER'),
        'defaultSMSType' => env('SNS_SMS_TYPE'),
        'usageReportS3Bucket' => env('SNS_SMS_REPORT_S3')
    ]
]

```

And now you can set your default configuration for SMS in `.env`

\*\* Note: \*\* More information how they work the settings at [http://docs.aws.amazon.com/en/sns/latest/api/API\_SetSMSAttributes.html](http://docs.aws.amazon.com/en/sns/latest/api/API_SetSMSAttributes.html)

Usage
-----

[](#usage)

### Sending SMS

[](#sending-sms)

To send sms without the need to create a topic, leave the `function via` as follows:

```
// Notifications/Welcome.php
/**
 * Get the notification channels.
 *
 * @param mixed $notifiable
 * @return array|string
 */
public function via($notifiable)
{
    return [
        AwsSnsSmsChannel::class
    ];
}

```

Add function `toAwsSnsSms()` expected by class `AwsSnsSmsChannel` to send notification:

```
// Notifications/Welcome.php
/**
 * Get the AWS SNS SMS Message representation of the notification.
 *
 * @param mixed $notifiable
 * @return \Lab123\AwsSns\Messages\AwsSnsMessage
 */
public function toAwsSnsSms($notifiable)
{
    return (new AwsSnsMessage())->message('Message Here')->phoneNumber('+5511999999999');
}

```

You also can ignore the `->phoneNumber()` in your notification and use function `routeNotificationForAwsSnsSms` in your Model Notifiable:

```
// Models/User.php
/**
 * Route notifications for the Aws SNS SMS channel.
 *
 * @return string
 */
public function routeNotificationForAwsSnsSms()
{
    return $this->phone_number;
}

```

\*\*Note.: \*\* The expected number use the standards-based international [E.123](https://en.wikipedia.org/wiki/E.123)

**eg.:** +5511999999999

### Sending Topic

[](#sending-topic)

To send notification to a topic, leave the `function via` as follows:

```
// Notifications/Welcome.php
/**
 * Get the notification channels.
 *
 * @param mixed $notifiable
 * @return array|string
 */
public function via($notifiable)
{
    return [
        AwsSnsTopicChannel::class
    ];
}

```

Add function `toAwsSnsTopic()` expected by class `AwsSnsTopicChannel` to send notification:

```
// Notifications/Welcome.php
/**
 * Get the AWS SNS Topic Message representation of the notification.
 *
 * @param mixed $notifiable
 * @return \Lab123\AwsSns\Messages\AwsSnsMessage
 */
public function toAwsSnsTopic($notifiable)
{
    return (new AwsSnsMessage())->message('Message Here')->topicArn('arn:aws:sns:us-east-1:000000000000:name-topic');
}

```

You also can ignore the `->topicArn()` in your notification and use function `routeNotificationForAwsSnsTopic` in your Model Notifiable:

```
// Models/User.php
/**
 * Route notifications for the Aws SNS Topic channel.
 *
 * @return string
 */
public function routeNotificationForAwsSnsTopic()
{
    return $this->topicArn;
}

```

### Available methods

[](#available-methods)

- `topicArn($topicArn)`: Your Topic Arn from Amazon SNS;
- `phoneNumber($phoneNumber)`: Phone number to send notification;
- `message($message)`: Message to be sent;

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)

- [Jean Pierre](https://github.com/jeanpfs)
- [Felipe Santos](https://github.com/felipeds2)

License
-------

[](#license)

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

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

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 ~0 days

Total

3

Last Release

958d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5035725cb99badcda1bac670e2ec5808d31ff98c9144e278fbff399fed1bb594?d=identicon)[andreshg112](/maintainers/andreshg112)

---

Top Contributors

[![jeanpfs](https://avatars.githubusercontent.com/u/8262794?v=4)](https://github.com/jeanpfs "jeanpfs (10 commits)")[![andreshg112](https://avatars.githubusercontent.com/u/15859884?v=4)](https://github.com/andreshg112 "andreshg112 (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/andreshg112-aws-sns/health.svg)

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

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/webpush

Web Push Notifications driver for Laravel.

7984.5M16](/packages/laravel-notification-channels-webpush)[laravel-notification-channels/fcm

FCM (Firebase Cloud Messaging) Notifications Driver for Laravel

5917.0M16](/packages/laravel-notification-channels-fcm)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)

PHPackages © 2026

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