grupodkt/notification-channel-sms
最新稳定版本:v6.0.1
Composer 安装命令:
composer require grupodkt/notification-channel-sms
包简介
Notification channel SMS
README 文档
README
This package makes it easy to send [Sms notifications] with Laravel 9.0.
Contents
Installation
You can install the package via composer:
composer require grupodkt/notification-channel-sms
Setting up your Waba account
Add your Sms Url, Auth Token, and phoneNumberId to your config/services.php:
// config/services.php ... 'sms' => [ 'url' => env('SMS_URL'), 'token' => env('SMS_TOKEN'), 'phoneNumberId' => env('SMS_PHONE_NUMBER_ID'), ], ...
Usage
Now you can use the channel in your via() method inside the notification:
use NotificationChannels\Sms\SmsChannel; use NotificationChannels\Sms\SmsMessage; use Illuminate\Notifications\Notification; class AccountApproved extends Notification { public function via($notifiable) { return [SmsChannel::class]; } public function toSms($notifiable) { return (new SmsMessage()) ->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 celular attribute of the Notifiable model. If you want to override this behaviour, add the routeNotificationForSms method to your Notifiable model.
public function routeNotificationForSms() { return $this->celular; }
Available Message methods
SmsMessage
from(''): Accepts a phone to use as the notification sender.content(''): Accepts a string value for the notification body.idCode(0): Accepts a integer value for the correlative id message.
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email carodas@grupodkt.com instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 29
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-04