irajtaghlidi/laravel-asanak-sms
Composer 安装命令:
composer require irajtaghlidi/laravel-asanak-sms
包简介
Asanak.com Notifications channel for Laravel 5.3+
README 文档
README
This package makes it easy to send notifications using asanak.com with Laravel 5.3+.
- You can use Queue with Redis to speed up your application.
Contents
Installation
You can install the package via composer:
composer require irajtaghlidi/laravel-asanak-sms
Then you must install the service provider:
// config/app.php 'providers' => [ ... NotificationChannels\AsanakSms\AsanakSmsServiceProvider::class, ],
Setting up the AsanakSms service
Add your AsanakSms login, username/password and default sender number to your config/services.php:
// config/services.php ... 'asanaksms' => [ 'username' => env('ASANAK_USERNAME'), 'password' => env('ASANAK_PASSWORD'), 'from' => env('ASANAK_FROM'), 'apiurl' => env('ASANAK_APIURL'), ], ...
Usage
You can use the channel in your via() method inside the notification:
use Illuminate\Notifications\Notification; use NotificationChannels\AsanakSms\AsanakSmsMessage; use NotificationChannels\AsanakSms\AsanakSmsChannel; class AccountApproved extends Notification { public function via($notifiable) { return [AsanakSmsChannel::class]; } public function toAsanakSms($notifiable) { return AsanakSmsMessage::create("Task #{$notifiable->id} is complete!"); } }
You can add a alias to config/app.php :
// config/app.php 'aliases' => [ ... 'asanaksms' => NotificationChannels\AsanakSms\AsanakSmsChannel::class, ],
You can use alias instead of class name in via() method:
use Illuminate\Notifications\Notification; use NotificationChannels\AsanakSms\AsanakSmsMessage; class AccountApproved extends Notification { public function via($notifiable) { return ['asanaksms']; } public function toAsanakSms($notifiable) { return AsanakSmsMessage::create("Task #{$notifiable->id} is complete!"); } }
In your notifiable model (for example App/User Model), make sure to include a routeNotificationForAsanaksms() method, which returns a phone number
or an array of phone numbers.
public function routeNotificationForAsanaksms() { return $this->phone; }
Available methods
from(): Sets the sender's phone number.
content(): Set a content of the notification message.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email irajtaghlidi@gmail.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.
统计信息
- 总下载量: 36
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-09