PHPackages                             swuppio/tiktok-wrapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. swuppio/tiktok-wrapper

ActiveLibrary[API Development](/categories/api)

swuppio/tiktok-wrapper
======================

TikTok PHP Wrapper

1.0.0(2y ago)04MITPHPPHP &gt;=8.1

Since Feb 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/swuppio/tiktok-wrapper)[ Packagist](https://packagist.org/packages/swuppio/tiktok-wrapper)[ RSS](/packages/swuppio-tiktok-wrapper/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

TikTok Wrapper
==============

[](#tiktok-wrapper)

This project is a wrapper designed to facilitate interactions with TikTok's API, focusing specifically on the Authentication and Display API segments. These components were the primary focus due to their relevance to my personal project requirements. However, the wrapper is built with extensibility in mind.

Should there be a need for additional functionality beyond what is currently implemented, I am open to expanding the capabilities of this wrapper. If you find yourself in need of more features, please feel free to open an issue detailing your requirements. This will help in enhancing the wrapper to cater to a broader range of needs within the TikTok API functionalities.

Getting Started
---------------

[](#getting-started)

### Prerequisites

[](#prerequisites)

To use this wrapper, you need to have PHP 8.1 or higher installed on your machine

### Installing

[](#installing)

The installation is done via Composer. To install the component, run the following command in your project directory:

```
composer require swuppio/tiktok-wrapper
```

### Examples

[](#examples)

In these examples, you'll see how to use the TikTok Wrapper to perform common tasks, such as fetching a user's username and refreshing an expired authentication token.

#### Fetching a User's Username

[](#fetching-a-users-username)

```
$wrp = new TikTokWrapper();

$authDto = $wrp
    ->getAuthApi('CLIENT_KEY', 'CLIENT_SECRET')
    ->fetchAccessToken('CODE', 'http://site.com/redirect_uri');

$displayApi = $wrp->getDisplayApi($authDto->accessToken);

$userInfoDto = $displayApi
    ->getUserInfo()
    ->setFields(
        UserInfoContract::Username->value,
        // ...
    )
    ->get();

echo $userInfoDto->username;
```

#### Refreshing an Expired Authentication Token

[](#refreshing-an-expired-authentication-token)

```
$wrp = new TikTokWrapper();

$authDto = $wrp
    ->getAuthApi('CLIENT_KEY', 'CLIENT_SECRET')
    ->refreshAccessToken('REFRESH_TOKEN');

echo $authDto->accessToken;
```

#### Ask for the video(s) information by IDs

[](#ask-for-the-videos-information-by-ids)

```
# code...

$displayApi = $wrp->getDisplayApi('ACCESS_TOKEN');

$queryVideosArr = $displayApi
    ->getQueryVideos()
    ->setFields(
        VideoContract::EmbedHtml->value,
        // ...
    )
    ->setVideoIds([
        '7251141220062350593',
        // ...
    ])
    ->get();

foreach ($queryVideosArr->videos as $video) {
    echo $video->embedHtml;
}
```

For more detailed information on all the capabilities of the TikTok Wrapper and additional examples, please refer to the [full documentation](https://swupp.io/components/tiktok-wrapper)

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

862d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ce5fcbd1d1faaaf59586f52e1215470e23d192f63f2cba41283cedf915b3ccc?d=identicon)[swuppio](/maintainers/swuppio)

---

Top Contributors

[![swuppio](https://avatars.githubusercontent.com/u/5064525?v=4)](https://github.com/swuppio "swuppio (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/swuppio-tiktok-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/swuppio-tiktok-wrapper/health.svg)](https://phpackages.com/packages/swuppio-tiktok-wrapper)
```

###  Alternatives

[storyblok/php-management-api-client

Storyblok PHP Client for Management API

1233.5k3](/packages/storyblok-php-management-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
