# short-video-distribution **Repository Path**: waset/short-video-distribution ## Basic Information - **Project Name**: short-video-distribution - **Description**: 国内最全的短视频平台SDK - **Primary Language**: PHP - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2022-04-20 - **Last Updated**: 2024-05-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 📦 国内最全的短视频平台 SDK # 介绍 ### 环境需求 - PHP >= 8.0.0 - [Composer](https://getcomposer.org/) >= 2.0 ### 适用平台 - [抖音](https://open.douyin.com/platform/doc) - [头条视频](https://open.douyin.com/platform/doc?doc=docs/openapi/video-management/toutiao/create-video/publish-video) - [西瓜视频](https://open.douyin.com/platform/doc?doc=docs/openapi/video-management/xigua/create-video/publish-video) - TODO... ### 适用框架 - [ThinkPHP](https://www.kancloud.cn/manual/thinkphp6_0) >= 6.0 - TODO... # 开始 #### 安装 ```bash composer require waset/short-video-distribution ``` #### 配置 ```php // config/distribute.php (ThinkPHP6 会自动生成) [ 'client_key' => '', 'client_secret' => '', 'scope' => [ 'trial.whitelist',, 'user_info', // ... ] ], // ... // "平台名" => [ // '密钥' => '', // '密码' => '', // '权限' => [ // ... // ] // ], ]; ``` #### 平台 => `$model` ``` 抖音 => 'douyin' 今日头条 => 'toutiao' 西瓜视频 => 'xigua' ``` #### 使用 ```php 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(); ``` # 鸣谢 - [ThinkPHP](https://github.com/top-think/framework) # License [MIT](./LICENSE)