waset / short-video-distribution
This package is abandoned and no longer maintained.
No replacement package was suggested.
国内最全的短视频平台SDK
v0.0.9
2022-05-12 08:56 UTC
Requires
- php: >=8.0.0
- topthink/framework: ^6.0.0
README
📦 国内最全的短视频平台 SDK
介绍
环境需求
- PHP >= 8.0.0
- Composer >= 2.0
适用平台
适用框架
- ThinkPHP >= 6.0
- TODO...
开始
安装
composer require waset/short-video-distribution
配置
// config/distribute.php (ThinkPHP6 会自动生成) <?php // 因各平台使用 scope 不一致,所以还是单独定义吧,不会太麻烦,毕竟只定这一次 return [ // 抖音 "douyin" => [ 'client_key' => '', 'client_secret' => '', 'scope' => [ 'trial.whitelist',, 'user_info', // ... ] ], // ... // "平台名" => [ // '密钥' => '', // '密码' => '', // '权限' => [ // ... // ] // ], ];
平台 => $model
抖音 => 'douyin'
今日头条 => 'toutiao'
西瓜视频 => 'xigua'
使用
use Waset\Distribute; // 获取绑定链接(结果是 url,如有需要自行生成二维码) // TODO:本插件提供二维码生成方法? $code = Distribute::app($model)->oauth()->code($scope, $redirect_uri, $state); // 获取token $data = Distribute::app($model)->oauth()->token($code); // $data = $data->toArray(); // 获取用户信息 $user_info = Distribute::app($model)->user()->info($data['access_token'], $data['open_id']); // $user_info = $user_info->toArray();