Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

waset/short-video-distribution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📦 国内最全的短视频平台 SDK

介绍

环境需求

适用平台

适用框架

开始

安装

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();

鸣谢

License

MIT