Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/itsnubix/aws-sns-sms-channel

AWS SNS SMS Notifications Channel for Laravel
https://github.com/itsnubix/aws-sns-sms-channel

aws laravel notifications sms sns

Last synced: about 6 hours ago
JSON representation

AWS SNS SMS Notifications Channel for Laravel

Awesome Lists containing this project

README

        

# AWS SNS SMS Notifications Channel for Laravel

[![Total Downloads](https://img.shields.io/packagist/dt/itsnubix/aws-sns-sms-channel.svg?style=flat-square)](https://packagist.org/packages/itsnubix/aws-sns-sms-channel)
[![Build Status](https://travis-ci.org/itsnubix/aws-sns-sms-channel.svg?branch=master)](https://travis-ci.org/itsnubix/aws-sns-sms-channel/)
[![Latest Stable Version](https://poser.pugx.org/itsnubix/aws-sns-sms-channel/v/stable.svg)](https://packagist.org/packages/itsnubix/aws-sns-sms-channel)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

## Installation

`composer require itsnubix/aws-sns-sms-channel`

In your `config/services.php` file enter:

```php
'sns' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('SNS_DEFAULT_REGION'),
],
```

Notice here that the region is not necessarily your standard `AWS_DEFAULT_REGION` as only certain regions allow SMS messages to be sent from them. [Click here](https://docs.aws.amazon.com/sns/latest/dg/sns-supported-regions-countries.html) for a list of nodes that allow SMS.

Be sure that the user who owns your access key and secret has at least the following policy on AWS IAM:

```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowSendingSMSMessages",
"Effect": "Allow",
"Action": [
"sns:Publish",
"sns:SetSMSAttributes",
"sns:CheckIfPhoneNumberIsOptedOut"
],
"Resource": ["*"]
}
]
}
```

Now in your notifications you can do the following:

```php
content('Hello world');
}
}
```

Finally you'll need to extend your notifiable class with the following function so it knows how to route SMS notifications.

```php
phone_number;
}
}
```

Need more help? [Read the article here](https://medium.com/@kylemilloy/sending-sms-messages-with-laravel-and-amazon-sns-a2183af9d90d)