PHPackages                             hsuan1117/line-notify-channel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. hsuan1117/line-notify-channel

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

hsuan1117/line-notify-channel
=============================

Use LINE Notify Service to notify users

1.0.1(2y ago)011MITPHPPHP &gt;=7.2

Since Oct 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/hsuan1117/laravel-line-notify)[ Packagist](https://packagist.org/packages/hsuan1117/line-notify-channel)[ Docs](https://github.com/laravel-notification-channels/line-notify-channel)[ RSS](/packages/hsuan1117-line-notify-channel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

Please see [this repo](https://github.com/laravel-notification-channels/channels) for instructions on how to submit a channel proposal.

Line Notify Laravel Notification Channel
========================================

[](#line-notify-laravel-notification-channel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/291fc97d79e2547b8c5226f6eaa296cd43cfd09d26c624528b5eb8fc6d8c30a7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f687375616e313131372f6c696e652d6e6f746966792d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hsuan1117/line-notify-channel)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b76ab1fea79aa7e68de8ca559a272a3518c1ac038d72bde34b1c7886a0bcc3ec/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f687375616e313131372f6c696e652d6e6f746966792d6368616e6e656c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/hsuan1117/line-notify-channel)[![StyleCI](https://camo.githubusercontent.com/768a6041e6d9e1d5da89e64c3e785631240f2736770dfa68d509c42a321135da/68747470733a2f2f7374796c6563692e696f2f7265706f732f3a7374796c655f63695f69642f736869656c64)](https://styleci.io/repos/:style_ci_id)[![SensioLabsInsight](https://camo.githubusercontent.com/7a395d7551140767a9f38f838e0e96b367bae56234402374185cd65ee8d795a1/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f3a73656e73696f5f6c6162735f69642e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/:sensio_labs_id)[![Quality Score](https://camo.githubusercontent.com/1f7b7aaa0248b25aed65ccddda76e5781688e041beda7fc28b719580f0f3ceb5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f687375616e313131372f6c696e652d6e6f746966792d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/hsuan1117/line-notify-channel)[![Code Coverage](https://camo.githubusercontent.com/34be30c118a94916e75ca64608f88161316f9bacd503119702e7f9c671798314/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f687375616e313131372f6c696e652d6e6f746966792d6368616e6e656c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/hsuan1117/line-notify-channel/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/fc0bc42573a3666ce288c8ff4c5dbf9bdd90647f516a3fac1b669187c8549eac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f687375616e313131372f6c696e652d6e6f746966792d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hsuan1117/line-notify-channel)

This package makes it easy to send notifications using [LINENotify](https://notify-bot.line.me/) with Laravel 8+.
To use this package, you must have a [LINENotify](https://notify-bot.line.me/) account.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up the LINENotify service](#setting-up-the-LINENotify-service)
- [Usage](#usage)
    - [Create Service](#create-service)
    - [Set up the credentials](#set-up-the-credentials)
    - [Use it for the notification](#use-it-for-the-notification)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require hsuan1117/line-notify-channel
```

### Setting up the LINENotify service

[](#setting-up-the-linenotify-service)

Optionally include a few steps how users can set up the service.

Usage
-----

[](#usage)

#### Create service

[](#create-service)

1. Use the button to create service. [![](.README_images/717d8859.png)](.README_images/717d8859.png)
2. You can get your client ID and client secret from the service page. [![](.README_images/0c54c9e2.png)](.README_images/0c54c9e2.png)

#### Set up the credentials

[](#set-up-the-credentials)

Add your LINE Notify client ID and client secret to your `.env` file:

```
LINE_NOTIFY_CLIENT_ID=your-client-id
LINE_NOTIFY_CLIENT_SECRET=your-client-secret
```

#### Use it for the notification

[](#use-it-for-the-notification)

Add to via() method in your notification class:

```
public function via($notifiable)
{
    return [LineNotifyChannel::class];
}
```

Add routeNotificationForLINENotify() method in your notification class:

```
public function routeNotificationForLINENotify($notifiable)
{
    return $notifiable->line_notify_token;
}
```

Add to toLINENotify() method in your notification class:

```
public function toLINENotify(object $notifiable): LINENotifyMessage
{
    return new LINENotifyMessage('Hello World!');
}
```

#### Configure the callback URL (not included in this package)

[](#configure-the-callback-url-not-included-in-this-package)

**Here is an example, use it at your own scenario**

1. Create a route for the callback URL

```
Route::prefix('line-notify')->group(function () {
    Route::post('gen', [LineNotifyController::class, 'generateLinkToken'])->name('line-notify.callback')->middleware('auth:sanctum');
    Route::post('link', [LineNotifyController::class, 'link'])->name('line-notify.callback');
});
```

2. Create a controller for the callback URL

```
