PHP code example of kangdev / douyin

1. Go to this page and download the library: Download kangdev/douyin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kangdev / douyin example snippets



$config = [
    'appid' => 'your-app-id',
    'secret' => 'your-secret',
    'debug' => true,
    'log' => [
        'name' => 'douyin',
        'file' => __DIR__ . '/douyin.log',
        'level' => 'debug',
        'permission' => 0777,
    ],
];

$dispatch = new \KangDev\DouyinDispatch\Dispatch($config);

// getAccessToken
$dispatch->token([
    'grant_type' => 'client_credential',
]);

//code2Session
$code = '';
$dispatch->jscode2session([
    'code'  => $code
]);