Twitter Ads API SDK for PHP v1.0 Now Available!



Now Available! Twitter Ads API SDK for PHP v1.0

Hi all,

I want to share with you the new milestone achieved in my library!

This update came with a BIG breaking change, Test if first before upgrade.

Main changes:

  • Now you not need to pass everytime the API instance, now is easier to work with it.
  • Async Stats. Every important entity (ACCOUNT, CAMPAIGN, LINE_ITEM,…) has its stats method, now in the third parameter you can set it to true or false if you want async request or not.
    $stats = $lineItem->stats( [ AnalyticsFields::METRIC_GROUPS_BILLING, AnalyticsFields::METRIC_GROUPS_MOBILE_CONVERSION, AnalyticsFields::METRIC_GROUPS_ENGAGEMENT, ], [ AnalyticsFields::START_TIME => $date[0], AnalyticsFields::END_TIME => $date[1], AnalyticsFields::GRANULARITY => Enumerations::GRANULARITY_TOTAL, AnalyticsFields::PLACEMENT => Enumerations::PLACEMENT_ALL_ON_TWITTER ], true );
  • All the fields available for every class are now accesible as constants. For example, you have Campaign class and CampaignFields class, with every field Campaign could need. This helps you to get the common constants for your get requests
  • Implicit Fetch: Before, in Cursor’s class (aka collection) you needed to fetch your collection when it reaches the end if you wanted more results. Now is implemented as a property. You can set it for your current cursor
    or make it by default

Hope this changes will help you to integrate easier with Twitter Ads API

You’re wellcome if you want to collaborate!

Next Steps:

  • Twitter Ads API v2 Integration

Project Homepage:

Have a question? Need to report an issue?


Nice, thanks Hector!! :tada::confetti_ball::slight_smile: