PHPackages                             ratiw/line-messaging - 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. [API Development](/categories/api)
4. /
5. ratiw/line-messaging

ActiveLibrary[API Development](/categories/api)

ratiw/line-messaging
====================

Simplify sending LINE messages using Messaging API.

1.2.0(1y ago)377MITPHPPHP ^8.1

Since Oct 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ratiw/line-messaging)[ Packagist](https://packagist.org/packages/ratiw/line-messaging)[ Docs](https://github.com/ratiw/line-messaging)[ RSS](/packages/ratiw-line-messaging/feed)WikiDiscussions main Synced 1mo ago

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

LINE Messaging for Laravel
==========================

[](#line-messaging-for-laravel)

Simplify sending LINE messages using Messaging API for Laravel

[![Latest Version on Packagist](https://camo.githubusercontent.com/8ebad0237051a066395650ed256af0f2e7f47a5af572d045fd75c10fc554c2ab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72617469772f6c696e652d6d6573736167696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ratiw/line-messaging)[![Total Downloads](https://camo.githubusercontent.com/9dd3ad7495fd1bfd858ca1ba084b8d61fa0b7d1183cea38db4b7a9c9bf2a6743/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72617469772f6c696e652d6d6573736167696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ratiw/line-messaging)

> This package was developed to replace the use LINE Notify as it will be discontinued on March 31, 2025.

Basic Usage
-----------

[](#basic-usage)

```
use Ratiw\LineMessaging\LineMessaging;
use Illuminate\Http\Client\Response;

// simple text message to a user
$response = LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toUser('USER_ID')
    ->text('Hi, this is a test message.');

// sticker message to a group chat
$response = LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toGroup('GROUP_ID')
    ->sticker('6359', '11069851');

// text with emojis
$response = LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toGroup('GROUP_ID')
    ->text('Hey, $ LINE emoji $', [
        ['productId' => '5ac2213e040ab15980c9b447', 'emojiId' => '009'],
        ['productId' => '5ac21d59031a6752fb806d5d', 'emojiId' => '004'],
    ]);
```

Understanding LINE Messaging API
--------------------------------

[](#understanding-line-messaging-api)

In order to send LINE messages via LINE Messaging API, you need the following:

- Channel access token
- User ID, Group ID, or Room ID
- what type of message you want to send

Getting those information can be tricky, but you usually do it once and then you can reuse it.

If you do not know how to get those information, please refer to the [LINE Messaging API](https://developers.line.biz/en/docs/messaging-api/overview/) documentation, Or search for video tutorials on YouTube.

### Getting User ID, Group ID, or Room ID

[](#getting-user-id-group-id-or-room-id)

You can definitely use a free [webhook.site](https://webhook.site) to gather user IDs with the LINE Messaging API, but there's a key point to remember: The user ID will only be included in the webhook data if the user has consented to share their profile information with your LINE Official Account.

That means the user has to add your LINE Official Account as a friend (and, you'll get the user ID from the webhook), or invite your LINE Official Account to a group chat (and, you'll get the group ID from the webhook).

### Message Types

[](#message-types)

This package currently supports the following message types:

- Text
- Sticker
- Image
- Video
- Audio
- Location

More might be added in the future, but no promises here. 😃

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

[](#installation)

You can install the package via composer:

```
composer require ratiw/line-messaging
```

Usage
-----

[](#usage)

Use the `LineMessaging::channel()` to specify the channel access token and **chain** one of the following methods to specify the target user, group, or room.

- `toUser`("USER\_ID")
- `toGroup`("GROUP\_ID")
- `toRoom`("ROOM\_ID")

Then, chain one of the available message types to send the message.

- `text`(message, emojis, quoteToken)
- `sticker`(packageId, stickerId)
- `image`(imageUrl, previewUrl)
- `video`(videoUrl, previewImageUrl, trackingId)
- `audio`(audioUrl, duration)
- `location`(title, address, latitude, longitude)

### Sending text message

[](#sending-text-message)

`text(string $message, $emojis = [], string $quoteToken = null)`

```
// send a text message to a user
LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toUser('USER_ID')
    ->text('Hello, world!');

// send a text message to a group chat
LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toGroup('GROUP_ID')
    ->text('Hello, world!');
```

---

### Sending text message with emojis

[](#sending-text-message-with-emojis)

To include emojis in the text message, you have to specify the emoji placeholders in the text message.

The placeholder is the `$` character in the message.

Then, you have to includes an array of emoji objects in the second argument.

Each emoji object must have the following keys:

- `productId`: The product ID of the emoji.
- `emojiId`: The emoji ID of the emoji.

```
LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toUser('USER_ID')
    ->text('$ Happy birthday! $', [
        ['productId' => '5ac2213e040ab15980c9b447', 'emojiId' => '007'],
        ['productId' => '5ac2213e040ab15980c9b447', 'emojiId' => '009'],
    ]);
```

See

- LINE emojis [here](https://developers.line.biz/en/docs/messaging-api/emoji-list/).
- LINE text message type [here](https://developers.line.biz/en/docs/messaging-api/message-types/#text-messages).
- LINE text message reference [here](https://developers.line.biz/en/reference/messaging-api/#text-message).

---

### Sending sticker

[](#sending-sticker)

`sticker($packageId, $stickerId)`

```
LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toGroup('GROUP_ID')
    ->sticker('6359', '11069851');
```

See

- LINE stickers list [here](https://developers.line.biz/en/docs/messaging-api/sticker-list/).
- LINE sticker message type [here](https://developers.line.biz/en/docs/messaging-api/message-types/#sticker-messages).
- LINE sticker message reference [here](https://developers.line.biz/en/reference/messaging-api/#sticker-message).

---

### Sending image

[](#sending-image)

`image(string $imageUrl, string $previewUrl = null)`

```
LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toGroup('GROUP_ID')
    ->image('https://example.com/image.jpg', 'https://example.com/image_preview.jpg');
```

> **Note**
>
> - `previewUrl` is optional.
> - given URL must be `https` scheme

See

- LINE images message type [here](https://developers.line.biz/en/docs/messaging-api/message-types/#image-messages).
- LINE image message reference [here](https://developers.line.biz/en/reference/messaging-api/#image-message).

---

### Sending video

[](#sending-video)

`video(string $videoUrl, string $previewImageUrl = null, string $trackingId = null)`

```
LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toUser('USER_ID')
    ->video('https://example.com/video.mp4', 'https://example.com/video_preview.jpg', 'TRACKING_ID');
```

> **Note**
>
> - `previewImageUrl` and `trackingId` are optional.
> - given URL must be `https` scheme

---

### Sending audio

[](#sending-audio)

`audio(string $audioUrl, int $duration)`

```
LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toUser('USER_ID')
    ->audio('https://example.com/video.m4a', 50000);
```

> **Note**
>
> - given URL must be `https` scheme
> - `duration` is in milliseconds

---

### Sending location

[](#sending-location)

`location(string $title, string $address, float $latitude, float $longitude)`

```
LineMessaging::channel('YOUR_CHANNEL_ACCESS_TOKEN')
    ->toUser('USER_ID')
    ->location('MOCA Bangkok', '499 Kamphaeng Phet 6 Rd, Lat Yao, Chatuchak, Bangkok 10900', 13.853197788942376, 100.56302862528158);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Rati Wannapanop](https://github.com/ratiw)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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 ~0 days

Total

3

Last Release

576d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/653f0e78cbefabf4d4b2ac2fc0a637ced64533da7beb7a716c1801628c4940a5?d=identicon)[ratiw](/maintainers/ratiw)

---

Top Contributors

[![ratiw](https://avatars.githubusercontent.com/u/807017?v=4)](https://github.com/ratiw "ratiw (13 commits)")

---

Tags

phplaravellineline notifyratiwline-messaging

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ratiw-line-messaging/health.svg)

```
[![Health](https://phpackages.com/badges/ratiw-line-messaging/health.svg)](https://phpackages.com/packages/ratiw-line-messaging)
```

###  Alternatives

[joisarjignesh/bigbluebutton

BigBlueButton Server API Library for Laravel

162145.5k1](/packages/joisarjignesh-bigbluebutton)[phattarachai/line-notify

PHP and Laravel API for Line application notification.

1630.9k](/packages/phattarachai-line-notify)[jeroen-g/flickr

Modern PHP package to make Flickr API calls. Ships with Laravel implementation.

2559.9k2](/packages/jeroen-g-flickr)[octw/aramex

A Library to integrate with Aramex APIs

2925.2k](/packages/octw-aramex)[exlo89/laravel-sevdesk-api

A helpful Sevdesk API client for Laravel.

1116.5k](/packages/exlo89-laravel-sevdesk-api)[dystcz/lunar-api

Dystore API layer for Lunar e-commerce package

411.1k3](/packages/dystcz-lunar-api)

PHPackages © 2026

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