1. Go to this page and download the library: Download ratiw/line-messaging library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ratiw / line-messaging example snippets
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'],
]);
// 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!');