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

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

lab123/aws-sns
==============

Amazon SNS Notifications Channel for Laravel 5.3

3228.8k↓100%11[1 issues](https://github.com/lab123it/aws-sns/issues)PHP

Since Sep 13Pushed 8y ago6 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Amazon SNS Notifications Channel for Laravel 5.3 \[WIP\]
========================================================

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

[![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

30

—

LowBetter than 64% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/43870afca82e96a19476ca142956c3bcafc2939fa4198c6bccab67e4340bbffe?d=identicon)[jeanpfs](/maintainers/jeanpfs)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M228](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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