promopult/tiktok-marketing-api

https://ads.tiktok.com API PHP包装器

v2.0.0 2023-06-21 07:47 UTC

README

/!\ WIP:尚未准备好用于生产。

TikTok营销API提供便捷的包装器。

Build Status Scrutinizer Code Quality Code Coverage

安装

$ composer require promopult/tiktok-marketing-api

"require": {
  // ...
  "promopult/tiktok-marketing-api": "*"
  // ...
}

使用

查看示例文件夹。

$credentials = \Promopult\TikTokMarketingApi\Credentials::fromAccessToken(
    getenv('__ACCESS_TOKEN__')
);

// Any PSR-18 HTTP-client
$httpClient = new \GuzzleHttp\Client();

$client = new \Promopult\TikTokMarketingApi\Client(
    $credentials,
    $httpClient
);

$response = $client->user->info();

print_r($response);

//Array
//(
//    [message] => OK
//    [code] => 0
//    [data] => Array
//        (
//            [create_time] => 1614175583
//            [display_name] => my_user
//            [id] => xxx
//            [email] => xxx
//        )
//
//    [request_id] => xxx
//)