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. [API Development](/categories/api)
4. /
5. msaaq/tiktok-php-sdk

ActiveLibrary[API Development](/categories/api)

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

TikTok Events API PHP Wrapper

v1.2.2(9mo ago)639.3k↓44.4%7[2 issues](https://github.com/msaaqcom/tiktok-php-sdk/issues)MITPHPCI passing

Since Nov 10Pushed 9mo 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 3d 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

40

—

FairBetter than 86% of packages

Maintenance50

Moderate activity, may be stable

Popularity37

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity47

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

282d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8091592?v=4)[Hussam Abd](/maintainers/Hussam3bd)[@Hussam3bd](https://github.com/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

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.9k3](/packages/defstudio-telegraph)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[flat3/lodata

OData v4.01 Producer for Laravel

99351.7k](/packages/flat3-lodata)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.7k1](/packages/jasara-php-amzn-selling-partner-api)

PHPackages © 2026

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