neolikotsi / laravel-smsportal
laravel 的 SMS Portal 通知通道
3.0.0
2020-11-03 13:53 UTC
Requires
- php: >=7.3
- guzzlehttp/guzzle: ^7.0.1
- illuminate/config: ~8.0
- illuminate/notifications: ~8.0
- neolikotsi/php-smsportal: ^1.0
Requires (Dev)
- mockery/mockery: ^1.0
This package is auto-updated.
Last update: 2024-09-19 22:45:32 UTC
README
laravel 的 SMS Portal 通知通道
短信通知
版本支持
Laravel 5.5+
安装
在由 SMSPortal 提供支持的 Laravel 中发送短信通知。在您可以通过 SMSPortal 发送通知之前,您需要安装 neolikotsi/laravel-smsportal
Composer 包
composer require neolikotsi/laravel-smsportal
该包将自动注册自身。
您可以使用以下命令发布迁移:
php artisan vendor:publish --provider="Illuminate\Notifications\SMSPortalServiceProvider"
这是已发布配置文件的内容
return [ 'client_id' => env('SMS_PORTAL_CLIENT_ID'), 'secret' => env('SMS_PORTAL_SECRET'), 'base_uri' => env('SMS_PORTAL_URL', 'https://rest.smsportal.com/v1/'), 'delivery_enabled' => env('SMS_PORTAL_DELIVERY_ENABLED', true), ];
格式化短信通知
如果通知支持作为短信发送,您应该在通知类上定义一个 toSmsPortal
方法。此方法将接收一个 $notifiable
实体,并应返回一个 Illuminate\Notifications\Messages\SMSPortalMessage
实例
/** * Get the SMSPortal / SMS representation of the notification. * * @param mixed $notifiable * @return SMSPortalMessage */ public function toSmsPortal($notifiable) { return (new SMSPortalMessage) ->content('Your SMS message content'); }
添加为交付通道
将通道 smsportal
添加到通知交付通道中。
/** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['mail', 'smsportal']; }
许可证
MIT 许可证(MIT)。请参阅 许可证文件 获取更多信息。
赞助商
₿ BTC 钱包:18YGRct3jRxkRyxsHG5ByLCkUef7MdXNMw