Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Tiktok Ads Laravel Package

jeffersongoncalves/laravel-tiktok-ads

Laravel wrapper for the TikTok Ads API that lets you manage campaigns, ad groups, creatives, and reporting from your PHP application. Provides a fluent client, configurable credentials, OAuth support, and Laravel-friendly integration for building and automating TikTok advertising workflows.

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package with Composer using the exact package name from its README, then set the required environment variables:

TIKTOK_ACCESS_TOKEN=
TIKTOK_ADVERTISER_ID=
TIKTOK_ADS_API_VERSION=

If the package ships a publishable config file, publish it and keep environment-specific values out of source control. In production, run php artisan config:clear after changing env values, or rebuild config cache.

Look first at:

  1. The package README for install and facade examples.
  2. The facade class and its docblock for the actual method surface.
  3. The service provider to see how the client is bound into the container.
  4. The package config file for defaults, API version handling, and advertiser ID usage.
  5. The package tests, if present, for expected request/response shapes.

A sensible first use case is a read-only smoke test: resolve the client, fetch advertiser info for TIKTOK_ADVERTISER_ID, then list campaigns with a small page size. This validates token validity, advertiser access, API version, and container wiring before you build create/update workflows.

Treat this as a low-level API client rather than a full domain package. Expect methods that map closely to TikTok Business API endpoints, and plan to wrap them in your own application service.

Implementation Patterns

Inject the package client or facade behind your own service class. Avoid calling the TikTok client directly from controllers, jobs, and Livewire components; centralize request construction, error mapping, logging, and retries.

For multi-advertiser applications, confirm whether the client reads TIKTOK_ADVERTISER_ID globally or accepts an advertiser ID per call. If it is global config, do not rely on a shared singleton with mutable config. Instead, create a per-account wrapper that resolves a configured client instance or explicitly passes the advertiser ID where supported.

Campaign workflows should follow the API lifecycle:

  • List campaigns with filters and pagination before creating duplicates.
  • Create new campaigns in a paused or draft state where the API allows it.
  • Persist TikTok campaign IDs immediately from create responses.
  • Update status through the dedicated status method rather than trying to patch arbitrary fields.
  • Record the TikTok API response payload for audit and debugging.

Ad group creation should always use the persisted campaign ID returned by TikTok, not a local placeholder. Validate required targeting, budget, and schedule fields before sending requests, because API validation errors are often field-specific and expensive to debug from raw responses.

For integrated reports, assume the request may be asynchronous. Queue report creation and polling in jobs, store the report ID, and persist both the raw report payload and a normalized table for querying. Do not block a web request while waiting for TikTok report generation.

For custom audiences, keep TikTok audience IDs mapped to your internal segments. Sync in batches through queued jobs, and verify TikTok’s hashing and identifier requirements before sending customer data. Do not log raw PII or access tokens.

Use Laravel’s HTTP fake support in tests if the package uses the default Laravel HTTP client. Otherwise, bind a fake implementation of the package client into the container and assert the payloads your service builds. Clear resolved facade instances between tests if you swap the facade.

Gotchas and Tips

This is a first release, so pin the exact version in composer.json and review source changes before upgrading. The package covers a focused slice of the TikTok Business API; do not assume every endpoint or field is supported.

The static TIKTOK_ACCESS_TOKEN configuration is a major operational consideration. There is no mention of OAuth refresh flow, token storage, or automatic rotation. Plan for token expiry and rotation, and avoid baking long-lived tokens into code or images.

Because configuration is environment-driven, remember Laravel’s config cache behavior. Changing TIKTOK_ACCESS_TOKEN, TIKTOK_ADVERTISER_ID, or TIKTOK_ADS_API_VERSION in production usually requires clearing or rebuilding config cache.

Handle TikTok API errors explicitly. Distinguish authentication failures, permission/advertiser-access failures, validation errors, rate limits, and server errors. Retry only transient failures such as 429 and 5xx, with backoff; do not blindly retry validation failures.

Pin TIKTOK_ADS_API_VERSION to a known-good version and test upgrades deliberately. TikTok API versions change independently of the package.

Check pagination behavior on campaign, ad group, report, and custom audience listings. Do not assume a list response contains all records.

Integrated reports may be delayed or asynchronous even if the package exposes a simple method. Design your UI and jobs around “requested,” “processing,” and “ready” states.

For multi-tenant or agency use cases, the global advertiser ID config is a likely limitation. Wrap the client carefully, avoid mutable singleton state, and confirm whether per-call advertiser overrides are supported.

Do not log full request headers or response bodies by default; access tokens and customer data can leak. Use structured logs with advertiser IDs, endpoint names, and TikTok request IDs where available.

Extension points are likely the container binding and facade. If the package lacks a needed endpoint or field, prefer wrapping the client in your own service first. If you need deeper changes, consider contributing upstream or forking, but keep the fork pinned and documented.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle