moririnson/laravel-line-notify
最新稳定版本:1.1.0
Composer 安装命令:
composer require moririnson/laravel-line-notify
包简介
line notify for laravel
README 文档
README
Requirement
- PHP 7.0+
- Laravel 5.5+
Installation
composer require moririnson/laravel-line-notify
Usage
Notification
Add token to your notifiable.
/** * @return string token */ public function routeNotificationForLINE() { return 'ACCESS_TOKEN_HERE'; }
Create your notification by make:notification and impl like this.
use Illuminate\Notifications\Notification; use Moririnson\LINENotify\Channels\LINENotifyChannel; use Moririnson\LINENotify\Messages\LINENotifyMessage; class LineNotify extends Notification { private $message; public function __construct($message) { $this->message = $message; } public function via($notifiable) { return [LINENotifyChannel::class] } public function toLINE($notifiable) { return (new LINENotifyMessage())->message($this->message); } }
Then you can call notify().
$notifiable->notify(new LINENotify('test message'));
Logging
Add this config to logging.php.
'stack' => [
'driver' => 'stack',
'channels' => ['line'],
],
'line' => [
'driver' => 'custom',
'token' => env('LOG_LINE_NOTIFY_ACCESS_TOKEN'),
'via' => \Moririnson\LINENotify\Logging\LINENotifyLogger::class,
'level' => 'error',
],
Testing
composer test
License
The MIT License (MIT), Please see License File for more information.
统计信息
- 总下载量: 10.36k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-11