定制 gcreate/line_notify 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gcreate/line_notify

Composer 安装命令:

composer require gcreate/line_notify

包简介

use line notify plugin for laravel

README 文档

README

Use Line notify plugin for laravel

Install Package

composer require gcreate/line_notify

Register Package Service Provider

// config/app.php
'providers' => [
  ...
  Gcreate\LineNotify\LineNotifyServiceProvider::class,
  ...
],

Make Config

php artisan vendor:publish --tag=line-notify-config

Make Migration to Users Table

php artisan vendor:publish --tag=line-notify-migration

php artisan migrate

add line_notify_access_token column and line_notify_state column

Add .env Parameter

LineNotifyClientID=Your Line Service ClientID
LineNotifyClientSecret=Your Line Service ClientSecret

Usage

Binding User Line

use Gcreate\LineNotify\Controllers\LineNotify;

$lineNotify = new LineNotify();

$redirectUrl = $lineNotify->bindLineUrl($userModel)

return redirect($redirectUrl);    // go binding line page

If binding user success, you need to save user Line notify token from callback

Recvive User Line Callback

To your routes/web.php add this

Route::post( 'your/callback/url', [yourController::class, 'callback'])->name('line-notify.callback');

Go to your Middleware/VerifyCsrfToken.php add this

protected $except = [
    'your/callback/url',
];
use Gcreate\LineNotify\Controllers\LineNotify;

$lineNotify = new LineNotify();

$callbackStatus = $lineNotify->callback($request, $user);

Revoke User Line

use Gcreate\LineNotify\Controllers\LineNotify;

$lineNotify = new LineNotify();

$result = $lineNotify->revoke($user);    // true | error
if($result){
    // ...do something
}

Send Message

use Gcreate\LineNotify\Controllers\LineNotify;

$lineNotify = new LineNotify();

$lineNotify->send($user,$text);

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-09