PHPackages                             msaaq/tiktok-php-sdk - 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. msaaq/tiktok-php-sdk

ActiveLibrary

msaaq/tiktok-php-sdk
====================

TikTok Events API PHP Wrapper

v1.2.2(7mo ago)631.6k↑12.9%7[2 issues](https://github.com/msaaqcom/tiktok-php-sdk/issues)MITPHPCI passing

Since Nov 10Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/msaaqcom/tiktok-php-sdk)[ Packagist](https://packagist.org/packages/msaaq/tiktok-php-sdk)[ Docs](https://github.com/msaaqcom/tiktok-php-sdk)[ RSS](/packages/msaaq-tiktok-php-sdk/feed)WikiDiscussions main Synced 1mo ago

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

TikTok Events API PHP Wrapper
=============================

[](#tiktok-events-api-php-wrapper)

Requirements
------------

[](#requirements)

- PHP 8.1 and later.

Installation
------------

[](#installation)

```
composer require msaaq/tiktok-php-sdk

```

Usage
-----

[](#usage)

```
$tiktok = new \Msaaq\TikTok\TikTok(accessToken: $token, pixelId: $pixelId);

$user = new \Msaaq\TikTok\Models\User();
$user->setUserAgent($_SERVER['HTTP_USER_AGENT'])
     ->setIpAddress($_SERVER['REMOTE_ADDR'])
     ->setEmails(['name@example.com']) // optional
     ->setPhones(['+12133734253']) // optional
     ->setClickId($_REQUEST['ttclid']) // if available
     ->setCookieId($_COOKIE['ttp'])
     ->setExternalIds(['user-id-in-our-system']); // optional

$page = new \Msaaq\TikTok\Models\Page();
$page->setUrl('https://example.com')
     ->setReferrer('https://example.com'); // optional

// Set products
$contents = [];
$order->items->map(function ($item) use (&$contents) {
    $contents[] = (new \Msaaq\TikTok\Models\Content)
        ->setPrice($item->price)
        ->setQuantity($item->quantity)
        ->setContentId($item->product_id)
        ->setContentName($item->item_title);
});

$properties = new \Msaaq\TikTok\Models\Property();
$properties->setCurrency('USD')
           ->setQuery('COUPON_CODE')
           ->setValue(100.99)
           ->setOrderId('order_id')
           ->setContents($contents)

$eventA = new \Msaaq\TikTok\Models\Event();
$eventA->setEventName(\Msaaq\TikTok\Enums\EventName::COMPLETE_PAYMENT)
       ->setEventTime(time())
       ->setEventId($order->uuid)
       ->setUser($value)
       ->setPage($page)
       ->setProperties($properties)
       ->setUser($value);

$eventB = new \Msaaq\TikTok\Models\Event();
$eventB->setEventName(\Msaaq\TikTok\Enums\EventName::PLACE_AN_ORDER)
       ->setEventTime(time())
       ->setEventId($order->uuid)
       ->setUser($value)
       ->setPage($page)
       ->setProperties($properties)
       ->setUser($value);
```

### Start event request

[](#start-event-request)

```
$eventRequest = $tiktok->events()
            ->setEventSource(\Msaaq\TikTok\Enums\EventSource::WEB);
if (!empty($testCode)) {
       $eventRequest->setTestEventCode($testCode); // optional
}
```

### Sending a single event

[](#sending-a-single-event)

```
$eventRequest->execute($eventA);
```

### Batching multiple events in a single payload

[](#batching-multiple-events-in-a-single-payload)

You can report up to 1000 objects in one request. If a request contains more than 1,000 events, the entire request will be rejected.

```
$eventRequest->execute([$eventA, $eventB]);
```

> To optimize campaign performance, it's highly recommended to send the event in real-time (without batching) as soon as it is seen on the advertiser's server.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance56

Moderate activity, may be stable

Popularity37

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

Every ~171 days

Total

5

Last Release

235d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/93d2a416b2b04dcc7a6d8acd2415198756694f68043494cc84e4983152a58397?d=identicon)[Hussam3bd](/maintainers/Hussam3bd)

---

Top Contributors

[![Hussam3bd](https://avatars.githubusercontent.com/u/8091592?v=4)](https://github.com/Hussam3bd "Hussam3bd (10 commits)")[![mikeatdovly](https://avatars.githubusercontent.com/u/170146708?v=4)](https://github.com/mikeatdovly "mikeatdovly (5 commits)")[![maherelgamil](https://avatars.githubusercontent.com/u/6294478?v=4)](https://github.com/maherelgamil "maherelgamil (4 commits)")[![felipemarques](https://avatars.githubusercontent.com/u/2640656?v=4)](https://github.com/felipemarques "felipemarques (1 commits)")

---

Tags

TikTok msaaqtiktok-php-sdktiktok-convention-api

### Embed Badge

![Health badge](/badges/msaaq-tiktok-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/msaaq-tiktok-php-sdk/health.svg)](https://phpackages.com/packages/msaaq-tiktok-php-sdk)
```

###  Alternatives

[ssovit/tiktok-api

Unofficial TikTok API for PHP

15035.9k](/packages/ssovit-tiktok-api)[socialiteproviders/tiktok

TikTok (tiktok.com) OAuth2 Provider for Laravel Socialite

17368.8k1](/packages/socialiteproviders-tiktok)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[jstolpe/tiktok-api-php-sdk

TikTok API PHP SDK

369.4k](/packages/jstolpe-tiktok-api-php-sdk)[truongbo/tiktok-api

Full API Tiktok Data

162.8k](/packages/truongbo-tiktok-api)

PHPackages © 2026

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