Package Data | |
---|---|
Maintainer Username: | peec |
Maintainer Contact: | kjelkenes@gmail.com (Petter Kjelkenes) |
Package Create Date: | 2016-12-26 |
Package Last Update: | 2016-12-26 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:13:59 |
Package Statistics | |
---|---|
Total Downloads: | 22,074 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 15 |
Total Watchers: | 3 |
Total Forks: | 2 |
Total Open Issues: | 2 |
Send sms trough AWS SNS.
You can install the package via composer:
composer require peec/aws-laravel-notification
You must install the service provider:
// config/app.php
'providers' => [
...
NotificationChannels\AWS\AWSSMSServiceProvider::class,
],
Add to your config/services.php
:
// config/services.php
...
'awssms' => [
'key' => env('AWSSMS_KEY'),
'secret' => env('AWSSMS_SECRET'),
'region' => env('AWSSMS_REGION'),
'from' => env('AWSSMS_FROM'), // optional
'max_price_usd' => '0.50' // Max price, sms wont send if price of the sms is more then this.
],
...
Now you can use the channel in your via()
method inside the notification:
use NotificationChannels\AWS\AWSSMSChannel;
use NotificationChannels\AWS\AWSSMSMessage;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [AWSSMSChannel::class];
}
public function toAwsSms($notifiable)
{
return (new AWSSMSMessage())
->content("Your {$notifiable->service} account was approved!");
}
}
In order to let your Notification know which phone are you sending/calling to, the channel will look for the phone_number
attribute of the Notifiable model. If you want to override this behaviour,
add the routeNotificationForAws
method to your Notifiable model.
public function routeNotificationForAws()
{
return '+1234567890';
}
from('')
: Accepts a phone to use as the notification sender.content('')
: Accepts a string value for the notification body.type('Transactional')
: Either Transactional or Promotional. See aws docs for SNS SMS. The pricing of these vary.Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email kjelkenes@gmail.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.