komptip / php-tiktok-sdk
PHP sdk for TikTok
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/komptip/php-tiktok-sdk
Requires
- guzzlehttp/guzzle: ^7.9
Requires (Dev)
- phpunit/phpunit: ^12.1
This package is auto-updated.
Last update: 2025-12-08 21:14:53 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.