Is there any Php Library with Ads Api Support?


Hi Everyone,

I am using @abraham’s twitteroauth library which works great with OAuth. But unfortunately it seems not have support of Ads API because its picking Api Host internally which is

Currently I am thinking to fork his repository and add my code to support Ads Api host, further I can send pull request. Is there any other better idea or somebody know of some PHP library which already has Ads Api Support?

Thanks in advance!



@mahsanamin there is currently no officially supported Twitter Ads API PHP library. You might want to have a look at @brandonmblack’s post here that details some of our plans to create and release some officially supported SDKs. This point that Brandon makes might be of interest to you, since PHP is not in our immediate pipeline:

With all these we’ll also be releasing a full suite of cross platform behavior tests that define how an SDK should behave in case you wanted to build your own or implement an SDK in a language we’ve chosen not to support officially. We’ll be regularly updating both the SDKs and our independent test suite with new features and changes as they release in the API.


The Ads API is something I’d like to support in TwitterOAuth. I haven’t decided yet what the implementation should look like or found the time to do it.


@andrs, Thank you! I also saw that link before but currently my project is in PHP, so for now I have added support of Host in existing abrahms library and the Ads api are working great with this addition.

@abraham , Thank you for your feed back. I am not sure I did right way but for now I added two methods (get/post) which take Host and APi version. Reason of taking Host and version as parameter is because Ads API also have support of Sandbox URL. I could do it your way like you did for root Twitter URL but I think adding a support to use any kind of Host in your library can be a good addition.

I will share the pull request after consulting the code changes with my other team members. The good news is that your library works great with Twitter Ads Api.


@abraham we should sync up. We’re building out SDKs in Ruby, Python and Java now all of which work well with their corresponding community Twitter gems. The Ads API iterates really quickly, new features every week and that’s why we wanted to officially support these APIs to help developers stay on top of those changes. We have more language support planned later, but we don’t have PHP on our list at the moment. We’d love to help support a community effort though.


Perfect plan!


Codebird-PHP 3.0.0, which is now in beta, supports accessing the Ads API. It looks like this:

$reply = $cb->ads_accounts_ACCOUNT_ID_cards_appDownload([
  'account_id' => '123456789',
  'name' => 'Test',
  'app_country_code' => 'DE'

Multiple-method API calls

In the Twitter Ads API, there are multiple methods that can be reached by HTTP GET, POST, PUT and/or DELETE. While Codebird does its best to guess which HTTP verb you’ll want to use, it’s the safest bet to give a hint yourself, like this:

$reply = $cb->ads_sandbox_accounts_ACCOUNT_ID_cards_imageConversation_CARD_ID([
  'httpmethod' => 'DELETE',
  'account_id' => '123456789',
  'card_id' => '2468013579'

Codebird will remove the httpmethod parameter from the parameters list automatically, and set the corresponding HTTP verb.

More info on Codebird-PHP & download at:


Have you checked this? :stuck_out_tongue: