forss/laravel-forss-sms-notifications
最新稳定版本:1.0.1
Composer 安装命令:
composer require forss/laravel-forss-sms-notifications
包简介
SMS Notification Driver for sms.forss.net
README 文档
README
Setting up the forss API service
Extend config/services.php to read your Forss SMS API credentials from your .env:
return [ ... 'forss_sms' => [ 'username' => env('FORSS_SMS_USERNAME'), 'password' => env('FORSS_SMS_PASSWORD'), 'sender' => env('FORSS_SMS_SENDER'), ] ];
Add your Forss SMS API credentials to your .env:
FORSS_SMS_USERNAME=username FORSS_SMS_PASSWORD=password FORSS_SMS_SENDER=sender
Usage
Create a notification
Add a toForssSms method to your Notification class:
namespace App\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use Forss\Laravel\Notifications\ForssSms\ForssSmsMessage; use Forss\Laravel\Notifications\ForssSms\ForssSmsChannel; class TestSms extends Notification { use Queueable; /** * Create a new notification instance. */ public function __construct() { // } /** * Get the notification's delivery channels. * * @return array<int, string> */ public function via(object $notifiable): array { return [ForssSmsChannel::class]; } public function toForssSms() { return ForssSmsMessage::create('Hello World'); } }
Add a routeNotificationForForssSms method to your Notifiable class:
class User extends Authenticatable { use Notifiable; public function routeNotificationForForssSms() { //Return whatever phone number to use for the SMS return $this->phone; } }
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2023-06-21