This package makes it easy to send notifications using LINE with Laravel 5.3.
You can install this package via composer:
composer require kpherox/laravel-notification-line
- Start using Messaging API
- Select Plan:
Developer Trial, Or upgrade toProafter selectingFree.
- Select Plan:
- Click the
Messaging settingsbutton on your channel. - Paste your channel's access token and secret, in your
services.phpconfig file:
...
'line' => [
'token' => env('LINE_CHANNEL_ACCESS_TOKEN'),
'secret' => env('LINE_CHANNEL_SECRET'),
'userd' => env('LINE_DEFAULT_USER_ID')
]
...
Follow Laravel's documentation to add the channel to your Notification class.
use NotificationChannels\Line\LineChannel;
use NotificationChannels\Line\LineMessage;
class NewsWasPublished extends Notification
{
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [LineChannel::class];
}
public function toLine($notifiable)
{
return new LineMessage('Laravel notifications are awesome!'/*, 'Multiple message. Max: 5'*/);
}
}If you need to change the user, add the routeNotificationForLine method to the model:
class LineUser extends Eloquent
{
use Notifiable;
public function routeNotificationForLine()
{
return $this->id;
}
...
Please see CHANGELOG for more information what has changed recently.
$ composer testIf you discover any security related issues, please email admin@mail.kr-kp.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.