fcorz/laravel-line-notify is a Laravel package for my awesome package.
It currently has 6 GitHub stars and 46 downloads on Packagist (latest version 1.0.0).
Install it with composer require fcorz/laravel-line-notify.
Discover more Laravel packages by fcorz
or browse all Laravel packages to compare alternatives.
Last updated
:rainbow: laravel line notify notification
Laravel implements the line notify message notification function. Including the binding of code in exchange for access token and notification channel message push.
you can install the package via composer:
composer require fcorz/laravel-line-notify
publish config
php artisan vendor:publish --provider="Fcorz\LaravelLineNotify\LaravelLineNotifyServiceProvider"
// get access_token by code
app('line-notify')->getAccessToken("O97YoWeYMV6vW3uYPFgPAC");
// response
{
"status":200,
"message":"access_token is issued",
"access_token":"1vIvPoq4aG4UOJYoQ6oriAUPvDNxxxxxxxxxxx"
}
// notify
$message = (new LaravelLineMessage())->message('hello world');
app('line-notify')->sendNotify($message, "access_token");
// get access_token by code
LaravelLineNotifyFacade::getAccessToken("O97YoWeYMV6vW3uYPFgPAC");
// notify
$message = (new LaravelLineMessage())->message('hello world');
LaravelLineNotifyFacade::sendNotify($message, "access_token");
public function routeNotificationForLine($notification)
{
return $this->notify_access_token;
}
use App\Models\UserMessage;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Notification;
class LineNotification extends Notification implements ShouldQueue
{
use Queueable;
protected $message;
public function __construct($message, $delay = 0)
{
$this->queue = 'notification';
$this->delay = $delay;
$this->message = $message;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['line'];
}
/**
* @param $notifable
* @return LineTemplateService
*/
public function toLineNotify($notifable)
{
return (new LaravelLineMessage())->message($this->message);
}
}
$receiver->notify(new LineNotification('hello world'));
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.