{"id":36982839,"url":"https://github.com/hborras/twitter-php-ads-sdk","last_synced_at":"2026-01-13T22:54:10.568Z","repository":{"id":46994997,"uuid":"54819361","full_name":"hborras/twitter-php-ads-sdk","owner":"hborras","description":"A Twitter supported and maintained Ads API SDK for PHP.","archived":true,"fork":false,"pushed_at":"2024-03-04T14:27:12.000Z","size":1265,"stargazers_count":56,"open_issues_count":17,"forks_count":41,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-09-07T22:46:04.042Z","etag":null,"topics":["php","sdk","sdk-php","twitte-ads","twitter","twitter-api"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hborras.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-27T08:27:27.000Z","updated_at":"2025-08-27T12:09:05.000Z","dependencies_parsed_at":"2024-06-19T01:44:02.624Z","dependency_job_id":"1901077b-0b61-4215-b324-d7b46d2280e3","html_url":"https://github.com/hborras/twitter-php-ads-sdk","commit_stats":{"total_commits":168,"total_committers":12,"mean_commits":14.0,"dds":0.5654761904761905,"last_synced_commit":"60c02b82ee7d84d173c3bf71c85eb93838c16310"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"purl":"pkg:github/hborras/twitter-php-ads-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hborras%2Ftwitter-php-ads-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hborras%2Ftwitter-php-ads-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hborras%2Ftwitter-php-ads-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hborras%2Ftwitter-php-ads-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hborras","download_url":"https://codeload.github.com/hborras/twitter-php-ads-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hborras%2Ftwitter-php-ads-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","sdk","sdk-php","twitte-ads","twitter","twitter-api"],"created_at":"2026-01-13T22:54:09.947Z","updated_at":"2026-01-13T22:54:10.555Z","avatar_url":"https://github.com/hborras.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Getting Started |Build Status| |Scrutinizer Status|\n---------------------------------------------------\n\nInstallation\n''''''''''''\n\n.. code:: bash\n\n    # installing the latest signed release\n    composer require hborras/twitter-php-ads-sdk\n\n\nQuick Start\n'''''''''''\n\n.. code:: php\n\n    const CONSUMER_KEY = 'your consumer key';\n    const CONSUMER_SECRET = 'your consumer secret';\n    const ACCESS_TOKEN = 'access token';\n    const ACCESS_TOKEN_SECRET = 'access token secret';\n    const ACCOUNT_ID = 'account id';\n\n\n    // Create Twitter Ads Api Instance\n    $api = TwitterAds::init(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);\n\n    $accounts = $api-\u003egetAccounts();\n    // load up the account instance, campaign and line item\n    $account = new Account(ACCOUNT_ID);\n    $account-\u003eread();\n    $campaigns = $account-\u003egetCampaigns('', [CampaignFields::COUNT =\u003e 1]);\n    $campaigns-\u003esetUseImplicitFetch(false);\n    $campaignsData = [];\n\n    // Create your campaign\n\n    $fundingInstruments = $account-\u003egetFundingInstruments();\n    $fundingInstrument = $fundingInstruments-\u003egetCollection()[0];\n\n    $campaign = new Campaign();\n    $campaign-\u003esetFundingInstrumentId($fundingInstrument-\u003egetId());\n    $campaign-\u003esetDailyBudgetAmountLocalMicro(1000000);\n    $campaign-\u003esetName(\"My first campaign: \");\n    $campaign-\u003esetEntityStatus('PAUSED');\n    $campaign-\u003esetStartTime(new \\DateTime());\n    $campaign-\u003esave();\n\n    // Automatic fetch from API when collection arrives to end:\n    $campaign-\u003esetUseImplicitFetch(true);\n\n    // Default fetch from API when collection arrives to end (GLOBAL):\n    Cursor::setDefaultUseImplicitFetch(true);\n\n    // Disable it\n    Cursor::setDefaultUseImplicitFetch(false);\n\n    // Async stats\n    $stats = $lineItem-\u003estats(\n        [\n            AnalyticsFields::METRIC_GROUPS_BILLING,\n            AnalyticsFields::METRIC_GROUPS_MOBILE_CONVERSION,\n            AnalyticsFields::METRIC_GROUPS_ENGAGEMENT,\n        ],\n        [\n            AnalyticsFields::START_TIME =\u003e $date[0],\n            AnalyticsFields::END_TIME =\u003e $date[1],\n            AnalyticsFields::GRANULARITY =\u003e Enumerations::GRANULARITY_TOTAL,\n            AnalyticsFields::PLACEMENT =\u003e Enumerations::PLACEMENT_ALL_ON_TWITTER\n        ], true\n    );\n    \n    // Sync stats, set parameter to false, or not include it\n    $stats = $lineItem-\u003estats(\n        [\n           AnalyticsFields::METRIC_GROUPS_BILLING,\n            AnalyticsFields::METRIC_GROUPS_MOBILE_CONVERSION,\n            AnalyticsFields::METRIC_GROUPS_ENGAGEMENT,\n        ],\n        [\n            AnalyticsFields::START_TIME =\u003e $date[0],\n            AnalyticsFields::END_TIME =\u003e $date[1],\n            AnalyticsFields::GRANULARITY =\u003e Enumerations::GRANULARITY_TOTAL,\n            AnalyticsFields::PLACEMENT =\u003e Enumerations::PLACEMENT_ALL_ON_TWITTER\n        ], false\n    );\n    \nField Constants\n---------------\n\n    Now, there are able Fields classes for every included class to make easier filter and create data\n    .. code:: php\n    AnalyticsFields::GRANULARITY -\u003e 'granularity'\n    AnalyticsFields::PLACEMENT -\u003e 'placement'\n    .\n    .\n    .\n\n\nDevelopment\n-----------\n\nIf you’d like to contribute to the project or try an unreleased\ndevelopment version of this project locally, you can do so quite easily\nby following the examples below.\n\n.. code:: bash\n\n    # clone the repository\n    git clone git@github.com:hborras/twitter-php-ads-sdk.git\n    cd twitter-php-ads-sdk\n\n    # install dependencies\n    composer install\n\nLicense\n-------\n\nThe MIT License (MIT)\n\nCopyright (c) 2019 Hector Borras\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n.. |Build Status| image:: https://travis-ci.org/hborras/twitter-php-ads-sdk.svg?branch=master\n:target: https://travis-ci.org/hborras/twitter-php-ads-sdk\n.. |Scrutinizer Status| image:: https://scrutinizer-ci.com/g/hborras/twitter-php-ads-sdk/badges/quality-score.png?b=master\n:target: https://scrutinizer-ci.com/g/hborras/twitter-php-ads-sdk","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhborras%2Ftwitter-php-ads-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhborras%2Ftwitter-php-ads-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhborras%2Ftwitter-php-ads-sdk/lists"}