promopult/tiktok-marketing-api

https://ads.tiktok.com API PHP-wrapper

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

README

/!\ WIP: Not ready for production.

Convenient wrapper for TikTok Marketing API.

Build Status Scrutinizer Code Quality Code Coverage

Installation

$ composer require promopult/tiktok-marketing-api

or

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

Usage

See examples folder.

$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
//)