Looking to hire Laravel developers? Try LaraJobs

laravel-tiktok-ads maintained by jeffersongoncalves

Description
Laravel integration for the TikTok Ads (TikTok Business) API
Last update
2026/09/08 02:59 (dev-main)
License
Downloads
1

Comments
comments powered by Disqus

Laravel TikTok Ads

Laravel TikTok Ads

Latest Version on Packagist Total Downloads License

Laravel integration for the TikTok Ads (TikTok Business) API — advertiser info, campaigns, ad groups, integrated reports and custom audiences.

Installation

You can install the package via composer:

composer require jeffersongoncalves/laravel-tiktok-ads

Publish the config file:

php artisan vendor:publish --tag="laravel-tiktok-ads-config"

Set your credentials in .env:

TIKTOK_ACCESS_TOKEN=
TIKTOK_ADVERTISER_ID=
TIKTOK_ADS_API_VERSION=v1.3

Get an access token from the TikTok for Business developer portal.

Usage

use JeffersonGoncalves\TiktokAds\Facades\TiktokAds;

TiktokAds::advertiserInfo(); // uses TIKTOK_ADVERTISER_ID by default
TiktokAds::advertiserInfo('7000000000000000000'); // or pass an advertiser id explicitly

TiktokAds::campaigns();
TiktokAds::campaigns(page: 2, pageSize: 50);

TiktokAds::createCampaign(name: 'My Campaign', objective: 'TRAFFIC', budgetMode: 'BUDGET_MODE_DAY', budget: 50.0);

TiktokAds::updateCampaignStatus(campaignIds: ['1790000000000000000'], status: 'DISABLE');

TiktokAds::adGroups();
TiktokAds::adGroups(campaignId: '1790000000000000000');

TiktokAds::report(
    startDate: '2026-01-01',
    endDate: '2026-01-31',
    dimensions: ['campaign_id'],
    metrics: ['spend', 'impressions', 'clicks', 'conversion'],
    dataLevel: 'AUCTION_CAMPAIGN',
);

TiktokAds::audiences();

Every method returns an Illuminate\Http\Client\Response, so you can chain ->json(), ->throw(), etc. Note that the TikTok Business API answers with HTTP 200 even on failure — check the code field in the payload:

$response = TiktokAds::campaigns();

if ($response->json('code') !== 0) {
    report(new RuntimeException($response->json('message')));
}

You can also resolve the client from the container instead of using the facade:

app(JeffersonGoncalves\TiktokAds\TiktokAds::class)->campaigns();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email the author instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.