PHPackages                             leochien/laravel-notification-channel-line - 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. leochien/laravel-notification-channel-line

ActiveLibrary

leochien/laravel-notification-channel-line
==========================================

LINE Notifications Channel for Laravel

1.3.0(12mo ago)12.9k↓41.4%MITPHPPHP &gt;=8.1CI passing

Since Oct 8Pushed 12mo ago1 watchersCompare

[ Source](https://github.com/s950329/laravel-notification-channel-line)[ Packagist](https://packagist.org/packages/leochien/laravel-notification-channel-line)[ RSS](/packages/leochien-laravel-notification-channel-line/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (5)Used By (0)

LINE Laravel Notifications Channel
==================================

[](#line-laravel-notifications-channel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ee9a5493c242c6cadb4f4d5bcc3adcff5c2d768d7c014e5fe80f995d37107fbd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c656f636869656e2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d6c696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/leochien/laravel-notification-channel-line)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/6bb3d1eebd7d73ceedb9a7dde4a7a6b938878257ca093efd3f4bd7fddea54b05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c656f636869656e2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d6c696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/leochien/laravel-notification-channel-line)

Introduction
------------

[](#introduction)

This package makes it easy to send notifications using [LINE](https://line.me/) with Laravel 5.6+.

Contents
--------

[](#contents)

- [LINE Laravel Notifications Channel](#line-laravel-notifications-channel)
    - [Introduction](#introduction)
    - [Contents](#contents)
    - [Installation](#installation)
        - [Setting up the LINE service](#setting-up-the-line-service)
    - [Usage](#usage)
        - [Text Message](#text-message)
            - [Available methods](#available-methods)
        - [Template Messages](#template-messages)
            - [Available methods](#available-methods-1)
        - [Flex Messages](#flex-messages)
            - [Available methods](#available-methods-2)
    - [Security](#security)
    - [Contributing](#contributing)
    - [Credits](#credits)
    - [License](#license)

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

[](#installation)

You can install the package via composer:

```
$ composer require leochien/laravel-notification-channel-line
```

### Setting up the LINE service

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

In order to send message to LINE channels, you need to obtain [Messaging API overview](https://developers.line.biz/en/docs/messaging-api/overview/).

Add your LINE Message API Token to your `config/services.php`:

```
// config/services.php
...
'line_message_api' => [
    'token' => env('LINE_MESSAGE_TOKEN', 'YOUR MESSAGE TOKEN HERE'),
],
...
```

Usage
-----

[](#usage)

### Text Message

[](#text-message)

Reference: [Text Message](https://developers.line.biz/en/reference/messaging-api/#text-message)You can use the channel in your `via()` method inside the notification:

```
use Illuminate\Notifications\Notification;
use LeoChien\LaravelNotificationChannelLine\LineMessage;
use LeoChien\LaravelNotificationChannelLine\LineWebhookChannel;

class TaskCompleted extends Notification
{
    public function via($notifiable): array
    {
        return [
            'line',
        ];
    }

    public function toLine($notifiable): LineMessage
    {
        return LineMessage::create()
            ->to('line_user_id')
            ->from('message_api_token') // optional if set in config
            ->content('Test message');
    }
}
```

#### Available methods

[](#available-methods)

`create()`: Initial a message instance.

`from()`: Optional. Sets the sender's access token. Default to the set in config.

`to()`: Required. Specifies the line user id to send the notification to.

`content()`: Required. Sets a content of the notification message. Only support plain text for now.

### Template Messages

[](#template-messages)

Reference: [Template messages](https://developers.line.biz/en/reference/messaging-api/#template-messages)

Currently, only 'buttons' and 'confirm' template types are supported. We will update to support 'carousel' and 'image carousel' as soon as possible.

```
use Illuminate\Notifications\Notification;
use LeoChien\LaravelNotificationChannelLine\LineTemplateMessage;
use LeoChien\LaravelNotificationChannelLine\LineWebhookChannel;

class TaskCompleted extends Notification
{
    public function via($notifiable): array
    {
        return [
            'line',
        ];
    }

    public function toLine($notifiable): LineMessage
    {
        return LineTemplateMessage::create()
            ->to('line_user_id')
            ->from('message_api_token') // optional if set in config
            ->type('buttons')
            ->thumbnailImageUrl('https://fakeimg.pl/350x200')
            ->text("This is the text of the message")
            ->actions([
                [
                    'type' => 'uri',
                    'label' => 'See more',
                    'uri' => 'https://example.com',
                ],
            ]);
    }
}
```

#### Available methods

[](#available-methods-1)

`from()`: Sets the sender's access token.

`to()`: Specifies the line user id to send the notification to.

`type()`: Required. template type, allowed value: buttons, confirm, carousel, image\_carousel.

`thumbnailImageUrl()`: Optional. Image URL (Max character limit: 2000). Protocol: HTTPS (TLS 1.2 or later). Image format: JPEG or PNG. Max width: 1024px. Max file size: 10 MB.

`imageAspectRatio()`: Optional. Aspect ratio of the image. Allowed values: rectangle(1.51:1), square(1:1). Default: rectangle.

`imageSize()`: Optional. Size of the image. Allowed Values: cover, contain. Default: cover.

`imageBackgroundColor()`: Optional. Background color of the image. Specify a RGB color value. Default: #FFFFFF (white)

`title()`: Optional. Message Title, max character limit: 40.

`text()`: Required. Message text, max character limit: 160 (no image or title), max character limit: 60 (message with an image or title).

`defaultAction()`: Optional. Action when image, title or text area is tapped.

`actions()`: Required. Action when tapped, max objects: 4.

### Flex Messages

[](#flex-messages)

Reference: [Flex messages](https://developers.line.biz/en/docs/messaging-api/using-flex-messages/)

Flex messages allow you to create richly laid out messages that can contain combinations of text, buttons, images, and more, arranged in a flexible layout.

```
use Illuminate\Notifications\Notification;
use LeoChien\LaravelNotificationChannelLine\LineFlexMessage;
use LeoChien\LaravelNotificationChannelLine\LineWebhookChannel;

class TaskCompleted extends Notification
{
    public function via($notifiable): array
    {
        return [
            'line',
        ];
    }

    public function toLine($notifiable): LineMessage
    {
        return LineFlexMessage::create()
            ->to('line_user_id')
            ->from('message_api_token') // optional if set in config
            ->altText('This is a Flex Message')
            ->contents([
                'type' => 'bubble',
                'body' => [
                    'type' => 'box',
                    'layout' => 'vertical',
                    'contents' => [
                        [
                            'type' => 'text',
                            'text' => 'Hello, World!',
                            'weight' => 'bold',
                            'size' => 'xl'
                        ],
                        [
                            'type' => 'box',
                            'layout' => 'vertical',
                            'margin' => 'lg',
                            'spacing' => 'sm',
                            'contents' => [
                                [
                                    'type' => 'text',
                                    'text' => 'This is a Flex Message',
                                    'color' => '#aaaaaa',
                                    'size' => 'sm',
                                    'flex' => 1
                                ]
                            ]
                        ]
                    ]
                ],
                'footer' => [
                    'type' => 'box',
                    'layout' => 'vertical',
                    'spacing' => 'sm',
                    'contents' => [
                        [
                            'type' => 'button',
                            'style' => 'primary',
                            'action' => [
                                'type' => 'uri',
                                'label' => 'Go to Website',
                                'uri' => 'https://example.com'
                            ]
                        ]
                    ]
                ]
            ]);
    }
}
```

#### Available methods

[](#available-methods-2)

`from()`: Optional. Sets the sender's access token. Default to the set in config.

`to()`: Required. Specifies the line user id to send the notification to.

`altText()`: Required. Alternative text for devices that don't support Flex Message.

`contents()`: Required. The JSON object that defines the layout and content of the Flex Message.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Leo Chien](https://github.com/s950329)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance50

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~74 days

Total

4

Last Release

364d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d4871534165ff48a48e77f38ae9f04e843ef7149245e6135622ed7ecf141f8a9?d=identicon)[leochien](/maintainers/leochien)

---

Top Contributors

[![s950329](https://avatars.githubusercontent.com/u/13188254?v=4)](https://github.com/s950329 "s950329 (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/leochien-laravel-notification-channel-line/health.svg)

```
[![Health](https://phpackages.com/badges/leochien-laravel-notification-channel-line/health.svg)](https://phpackages.com/packages/leochien-laravel-notification-channel-line)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/webpush

Web Push Notifications driver for Laravel.

7984.5M16](/packages/laravel-notification-channels-webpush)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
