medkad/laravel-isms
Composer 安装命令:
composer require medkad/laravel-isms
包简介
Laravel Notification Channel For iSMS
README 文档
README
Getting started
Please register to your account credentials at iSMS Official Website. The API is using Basic Authentication(so username and password will do).
Installation
via composer:
composer require medkad/laravel-isms
Publish iSMS Config File
php artisan vendor:publish --provider="Medkad\ISMS\ISMSServiceProvider"
Setting up your configuration
Add your ISMS Account credentials to your config/isms.php:
// config/isms.php ... 'username' => env('ISMS_USERNAME', 'medkad'), 'password' => env('ISMS_PASSWORD', 'password'), 'url' => env('ISMS_URL', 'https://www.isms.com.my/RESTAPI.php'), ...
// .env ... ISMS_USERNAME= ISMS_PASSWORD= ISMS_URL='https://www.isms.com.my/RESTAPI.php' ...
In order to let your Notification know which phone are you sending to, the channel will look for the mobile_number attribute of the Notifiable model (eg. User model). If you want to override this behaviour, add the routeNotificationForISMS method to your Notifiable model.
public function routeNotificationForISMS() { return $this->phone_number; }
Usage
Now you can use the channel in your via() method inside the notification:
use Medkad\ISMS\ISMS; use Medkad\ISMS\ISMSChannel; use Illuminate\Notifications\Notification; class OrderNotification extends Notification { public function via($notifiable) { return [ISMSChannel::class]; } public function toISMS($notifiable) { return new ISMS('Your SMS Here!'); } }
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-08