rouxtaccess / laravel-smsportal
laravel的短信门户通知通道
3.0.2
2024-08-07 11:34 UTC
Requires
- php: >=7.0
- guzzlehttp/guzzle: >=7.0
- illuminate/config: >=8.0
- illuminate/notifications: >=8.0
- neolikotsi/php-smsportal: ^1.0
Requires (Dev)
- mockery/mockery: ^1.0
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-09-07 11:55:30 UTC
README
laravel的短信门户通知通道
短信通知
版本支持
Laravel 5.5+, 6, 7
安装
通过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)。有关更多信息,请参阅许可证文件。