Download the PHP package ratiw/line-messaging without Composer
On this page you can find all versions of the php package ratiw/line-messaging. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ratiw/line-messaging
More information about ratiw/line-messaging
Files in ratiw/line-messaging
Package line-messaging
Short Description Simplify sending LINE messages using Messaging API.
License MIT
Homepage https://github.com/ratiw/line-messaging
Informations about the package line-messaging
LINE Messaging for Laravel
Simplify sending LINE messages using Messaging API for Laravel
This package was developed to replace the use LINE Notify as it will be discontinued on March 31, 2025.
Basic Usage
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 documentation, Or search for video tutorials on YouTube.
Getting User ID, Group ID, or Room ID
You can definitely use a free 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
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. :smiley:
Installation
You can install the package via composer:
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
text(string $message, $emojis = [], string $quoteToken = null)
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.
See
Sending sticker
sticker($packageId, $stickerId)
See
Sending image
image(string $imageUrl, string $previewUrl = null)
Note
previewUrl
is optional.- given URL must be
https
scheme
See
Sending video
video(string $videoUrl, string $previewImageUrl = null, string $trackingId = null)
Note
previewImageUrl
andtrackingId
are optional.- given URL must be
https
scheme
Sending audio
audio(string $audioUrl, int $duration)
Note
- given URL must be
https
schemeduration
is in milliseconds
Sending location
location(string $title, string $address, float $latitude, float $longitude)
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
- Rati Wannapanop
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.