Download the PHP package linecorp/line-bot-sdk without Composer
On this page you can find all versions of the php package linecorp/line-bot-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download linecorp/line-bot-sdk
More information about linecorp/line-bot-sdk
Files in linecorp/line-bot-sdk
Package line-bot-sdk
Short Description SDK of the LINE BOT API for PHP
License Apache-2.0
Homepage https://github.com/line/line-bot-sdk-php
Rated 1.50 based on 2 reviews
Informations about the package line-bot-sdk
LINE Messaging API SDK for PHP
Introduction
The LINE Messaging API SDK for PHP makes it easy to develop bots using LINE Messaging API, and you can create a sample bot within minutes.
Documentation
See the official API documentation for more information.
- English: https://developers.line.biz/en/docs/messaging-api/overview/
- Japanese: https://developers.line.biz/ja/docs/messaging-api/overview/
PHPDoc
Requirements
- PHP 8.2 or later
Installation
Install the LINE Messaging API SDK using Composer.
Getting started
Create the bot client instance
The bot client instance is a handler of the Messaging API.
You must use the Client with GuzzleHttp\ClientInterface implementation.
Call API
You can call an API through the messagingApi instance.
A very simple example:
This procedure sends a message to the destination that is associated with <reply token>.
We also support setter style.
How to get x-line-request-id header and error message
You may need to store the x-line-request-id header obtained as a response from several APIs. In this case, please use ~WithHttpInfo functions. You can get headers and status codes. The x-line-accepted-request-id or content-type header can also be obtained in the same way.
You can get error messages from \LINE\Clients\MessagingApi\ApiException when you use MessagingApiApi. Each client defines its own exception class.
When you need to get x-line-accepted-request-id header from error response, you can get it: $headers['x-line-accepted-request-id'][0].
Components
Webhook
LINE's server sends user actions (such as a message, image, or location) to your bot server. Request of that contains event(s); event is action of the user.
The following shows how the webhook is handled:
- Receive webhook from LINE's server.
- Parse request payload by
EventRequestParser#parseEventRequest($body, $channelSecret, $signature). - Iterate parsed events and some react as you like.
The following examples show how webhooks are handled:
- EchoBot: Route.php
- KitchenSink: Route.php
More information
For more information, see the official API documents and PHPDoc.
If it's your first time using this library, we recommend taking a look at examples and the PHPDoc of \LINE .
Hints
Examples
This repository contains two examples of how to use the LINE Messaging API.
EchoBot
A simple sample implementation. This application reacts to text messages that are sent from users.
KitchenSink
A full-stack (and slightly complex) sample implementation. This application demonstrates a practical use of the LINE Messaging API.
PHPDoc
https://line.github.io/line-bot-sdk-php/
This library provides PHPDoc to describe how to use the methods. You can generate the documentation locally:
Official API documentation
Official API documents shows the detail of Messaging API and fundamental usage of SDK.
See also
Laravel Support
Easy to use from Laravel.
After installed, add LINE_BOT_CHANNEL_ACCESS_TOKEN to .env
then you can use facades like following.
Facade uses \GuzzleHttp\Client by default. If you want to change the config, run
Then line-bot.php will be published to config/ dir.
If you want to configure a custom header, do the following.
Help and media
FAQ: https://developers.line.biz/en/faq/
News: https://developers.line.biz/en/news/
Versioning
This project respects semantic versioning.
However, if a feature that was publicly released is discontinued for business reasons and becomes completely unusable, we will release changes as a patch release.
Contributing
Please check CONTRIBUTING before making a contribution.
For hacking instructions, please refer HACKING.md.
License
All versions of line-bot-sdk with dependencies
composer-runtime-api Version ^2.0
guzzlehttp/guzzle Version ^7.3
guzzlehttp/psr7 Version ^1.7 || ^2.0