PHP code example of yc-hwc / laravel-tiktok

1. Go to this page and download the library: Download yc-hwc/laravel-tiktok 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/ */

    

yc-hwc / laravel-tiktok example snippets

`
    $config = [
        'tiktokUrl'   => '',
        'appKey'      => '',
        'appSecret'   => '',
        'accessToken' => '',
        'shopCipher'  => '',
    ];
    $tiktokClient = \PHPTiktok\V202309\TiktokClient::config($config);
    $response = $tiktokClient->order()->api('orders')
        ->withBody([
            'order_status' => 'UNPAID',
        ])
        ->withQueryString([
            'page_size' => 1
        ])->port();
    print_r($response);die;
    
    tips: /开头为绝对路径uri,不是/开头为相对路径uri,建议使用绝对路径uri
`
    $config = [
        'tiktokUrl'  => '',
    ];
    $tiktokSDK = \PHPTiktok\TiktokSDK::config($config);

    return [
        'redirectUrl' => $tiktokSDK->oauth()->api('authorize')
            ->withQueryString(array_filter([
                'app_key' => '',
                'state'   => '',
            ]))
            ->fullUrl()
    ];
`
    $config = [
        'tiktokUrl'   => '',
        'appKey'      => '',
        'appSecret'   => '',
        'accessToken' => '',
        'shopId'      => '',
        'shopCipher'  => '',
    ];
    $tiktokSDK = \PHPTiktok\TiktokSDK::config($config);
    $response = $tiktokSDK->order()->api('/api/orders/search')
        ->withBody([
            'page_size' => 20,
        ])->post();
    print_r($response);
    
    tips: /开头为绝对路径uri,不是/开头为相对路径uri,建议使用绝对路径uri