1. Go to this page and download the library: Download yidas/line-notify-sdk 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/ */
// Get accessToekn by automatically obtaining callback code from query string
$accessToken = $lineNotifyAuth->getAccessToken();
// Send notification with accessToken (Concurrency supported)
$lineNotify = new \yidas\lineNotify\Notify($accessToken);
$result = $lineNotify->notify('Hello!');
use yidas\lineNotify\Auth;
use yidas\lineNotify\Notify;
$lineNotifyAuth = new \yidas\lineNotify\Auth([
'clientId' => 'Your LINE Notify service's client ID',
'clientSecret' => 'Your LINE Notify service's client Secret',
// 'debug' => true,
// 'log' => true,
]);
public string getAuthUrl(string $redirectUrl=null, string $state='none', string $responseMode=null)
// Set redirectUrl to `/callback` from the same path of current URL
define('LINE_NOTIFY_REDIRECT_URL', \yidas\lineNotify\Auth::getWebPath() . "/callback");
$authUrl = $lineNotifyAuth->getAuthUrl(LINE_NOTIFY_REDIRECT_URL);
public string getAccessToken(string $redirectUri=false, string $code=false, boolean $stateForVerify=false)
$accessToken = $lineNotifyAuth->getAccessToken(LINE_NOTIFY_REDIRECT_URL, $_GET['code'], 'CSRF state for verifying');
static public string getCode(string $stateForVerify=false)
public integer notify(string $message, array $options=[], string|array $accessTokens=false)
// Send single notification with one accessToken
$lineNotify = new \yidas\lineNotify\Notify('HkyggKbHymoS*****************sFuVfa0mlcBNPI');
$result = $lineNotify->notify('Hello!');
// Send notification for multiple accessTokens concurrently
$lineNotify = new \yidas\lineNotify\Notify(['GymoS****', 'Afa0****']);
$sccessNum = $lineNotify->notify('Hello everyone!');