LINE Messaging API SDK for PHP

Laravel integration

This SDK includes a Laravel service provider with facades.

Setup

Add your channel access token to .env :

LINE_BOT_CHANNEL_ACCESS_TOKEN=<Channel Access Token>

Then use the facades directly:

\LINEMessagingApi::pushMessage($request);

Custom configuration

To customize the HTTP client configuration, publish the config file:

php artisan vendor:publish --provider="LINE\Laravel\LINEBotServiceProvider" --tag=config

This creates config/line-bot.php :

return [
    'channel_access_token' => env('LINE_BOT_CHANNEL_ACCESS_TOKEN'),
    'channel_id' => env('LINE_BOT_CHANNEL_ID'),
    'channel_secret' => env('LINE_BOT_CHANNEL_SECRET'),
    'client' => [
        'config' => [
            'headers' => ['X-Foo' => 'Bar'],
        ],
    ],
];

Search results