2017 © Pedro Peláez
 

library laravel-line-notify

line notify webhook pkg

image

dustinhsiao21/laravel-line-notify

line notify webhook pkg

  • Sunday, March 18, 2018
  • by dustinhsiao21
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Webhook notifications channel for Laravel 5.3 Build Status StyleCI

Requirement

  • PHP 7.0+
  • Laravel 5.3+

Installation

composer require dustinhsiao21/laravel-line-notify

Usage

Add the routeNotificationForLine method to your Notifiable model. This method needs to return your Line Notify OAuth2 token. Read me Document, (*1)

/**
* @return string Line Notify OAuth2 token
*/
public funtcion routeNotificationForLine()
{
    return 'ADD_YOUR_ACCESS_TOKEN_HERE';
}

Then you can use the channel in your via() method inside the notification. Also you can add the toLine() method., (*2)

<?php

namespace App\Notifications;

use dustinhsiao21\LineNotify\LineChannel;
use dustinhsiao21\LineNotify\LineMessage;
use Illuminate\Notifications\Notification;

class LineNotify extends Notification
{
    private $message;

    public funtion __construct($message)
    {
        $this->message = $message;    
    } 
    public funtcion via($notifiable)
    {
        return [LineChannel::class]
    }

    public funtcion toLine($notifiable)
    {
        return (new LineMessage())->message($message);
    }
}

Now you can use notifiable->notify() to send the Notify. For example, If you use user as the model., (*3)

$user = User::find(1);
$user->notify(New LineNotify('Hello World'));

Testing

composer test

Security

If you discover any security issues, please email dustinhsiao21@gmail.com instead of using the issue tracker., (*4)

License

The MIT License (MIT), Please see License File for more information., (*5)

The Versions