revolution/laravel-line-sdk
最新稳定版本:4.1.0
Composer 安装命令:
composer require revolution/laravel-line-sdk
包简介
LINE SDK for Laravel
README 文档
README
Features
- Working with Laravel Event System. Including Webhook routing and controller.
- Extensible Bot Client.
- Working with Laravel Notification System(LINE Messaging API)
- Including Socialite drivers(LINE Login)
Requirements
- PHP >= 8.2
- Laravel >= 11.0
Installation
composer require revolution/laravel-line-sdk
Uninstall
composer remove revolution/laravel-line-sdk
- Delete related files. See below.
Configuration
.env
Set up in LINE Developers console. https://developers.line.biz/
Note: You can no longer create a Messaging API channel directly from the LINE Developers Console. To create a Messaging API channel, first create a LINE Official Account using the [Create LINE Official Account] button. Then, enable Messaging API usage from the LINE Official Account Manager.
Create two channels Messaging API and LINE Login.
- Messaging API : Get
Channel access token (long-lived)andChannel secret. SetWebhook URL - LINE Login : Get
Channel IDandChannel secret. SetCallback URL
LINE_BOT_CHANNEL_TOKEN=
LINE_BOT_CHANNEL_SECRET=
LINE_LOGIN_CLIENT_ID=
LINE_LOGIN_CLIENT_SECRET=
LINE_LOGIN_REDIRECT=
Publishing(Optional)
php artisan vendor:publish --tag=line-config
Quick Start
Prepare
- Create
Messaging APIchannel in LINE Developers console. - Get
Channel access token (long-lived),Channel secretand QR code. - A web server that can receive webhooks from LINE. Not possible on a normal local server.
Create new Laravel project
laravel new line-bot
cd ./line-bot
composer require revolution/laravel-line-sdk
Edit .env
LINE_BOT_CHANNEL_TOKEN=
LINE_BOT_CHANNEL_SECRET=
Publishing Listeners
php artisan vendor:publish --tag=line-listeners
Deploy to web server
- Set
Webhook URLin LINE Developers console.https://example.com/line/webhook - Verify Webhook URL.
Add bot as a friend.
- Using QR code.
Send test message
Bot returns same message.
Documents
Demo
https://github.com/invokable/laravel-line-project
LICENSE
MIT
统计信息
- 总下载量: 34.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-14