komptip / php-tiktok-sdk
PHP sdk for TikTok
v1.1.0
2025-05-27 12:58 UTC
Requires
- guzzlehttp/guzzle: ^7.9
Requires (Dev)
- phpunit/phpunit: ^12.1
This package is auto-updated.
Last update: 2025-07-08 20:24:35 UTC
README
This package provides an wrapper for TikTok REST API for PHP 8.3 and later
Requirements
- PHP >= 8.3
Installation
In your exist PHP application you can install this package using Composer.
composer require komptip/php-tiktok-sdk
Usage
Check documentation for basic understanding of configuration and usage, and user authentication for user authentication
Here is a basic example of how to use this package:
use Komptip\PhpTiktokSdk\PhpTiktokSdk; use Komptip\PhpTiktokSdk\AuthorizationScope; use Komptip\PhpTiktokSdk\UserField; $tiktok = new PhpTiktokSdk('client_key', 'client_secret'); // Get auth url $authUrl = $tiktok->createAuthUrl( scopes: [AuthorizationScope::UserInfoBasic, AuthorizationScope::UserInfoProfile], csrfState: $tiktok->createCsrfState(), redirectUri: 'https://example.com/callback' ); // Get access token $accessToken = $tiktok->getAccessToken($authorizationCode); // Get user info $userInfo = $tiktok->getUserInfo($accessToken['access_token'], [UserField::OpenID, UserField::Displayname]);
State of the project
This package is in early development stage. Not all endpoints are implemented yet.
- Login kit User authorization Ready to use Documentation
- Content posting API Posting videos and images to user profile Not implemented yet
- Data Portability API Getting user data such as activity, comments, etc. Not implemented yet
- Display API User profile information Ready to use Documentation
License
This package is licensed under the MIT License.