All Projects → hborras → twitter-php-ads-sdk

hborras / twitter-php-ads-sdk

Licence: other
A Twitter supported and maintained Ads API SDK for PHP.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to twitter-php-ads-sdk

100daysofcode Twitter Bot
Twitter bot for #100DaysOfCode
Stars: ✭ 214 (+319.61%)
Mutual labels:  twitter-api
terraform-provider-twitter
No description or website provided.
Stars: ✭ 24 (-52.94%)
Mutual labels:  twitter-api
TwitterAutoReplyBot
This is a tiny Python script that replies to a specified number of tweets containing a specified hashtag.
Stars: ✭ 33 (-35.29%)
Mutual labels:  twitter-api
Twitterdelete
💀 Delete your old, unpopular tweets.
Stars: ✭ 231 (+352.94%)
Mutual labels:  twitter-api
mokkapps
My GitHub profile README which is automatically updated. Please ⭐️ if you like it
Stars: ✭ 63 (+23.53%)
Mutual labels:  twitter-api
laravel-youtrack-sdk
Laravel wrapper for the YouTrack PHP Software Development Kit provides set of tools to interact with JetBrains YouTrack.
Stars: ✭ 17 (-66.67%)
Mutual labels:  sdk-php
Jekyll Twitter Plugin
A Liquid tag plugin for the Jekyll blogging engine that embeds Tweets, Timelines and more from Twitter API
Stars: ✭ 204 (+300%)
Mutual labels:  twitter-api
stweet
Advanced python library to scrap Twitter (tweets, users) from unofficial API
Stars: ✭ 287 (+462.75%)
Mutual labels:  twitter-api
TwitterScraper
Scrape a User's Twitter data! Bypass the 3,200 tweet API limit for a User!
Stars: ✭ 80 (+56.86%)
Mutual labels:  twitter-api
grasp
Essential NLP & ML, short & fast pure Python code
Stars: ✭ 58 (+13.73%)
Mutual labels:  twitter-api
Egg Mode
a twitter api crate for rust
Stars: ✭ 249 (+388.24%)
Mutual labels:  twitter-api
twitter-status
Twitter Status Web Component
Stars: ✭ 59 (+15.69%)
Mutual labels:  twitter-api
twitter api
A Dart wrapper for the Twitter API v1.1
Stars: ✭ 56 (+9.8%)
Mutual labels:  twitter-api
Harpy
A Twitter app built with Flutter
Stars: ✭ 211 (+313.73%)
Mutual labels:  twitter-api
spark-twitter-sentiment-analysis
Sentiment Analysis of a Twitter Topic with Spark Structured Streaming
Stars: ✭ 55 (+7.84%)
Mutual labels:  twitter-api
Tweetledee
A PHP library that provides an incredibly easy way to access Twitter data as JSON or RSS feed by URL or standard CLI syntax.
Stars: ✭ 208 (+307.84%)
Mutual labels:  twitter-api
tweet png
A flutter app to generate beautiful, high-quality screenshots of tweets from twitter.
Stars: ✭ 51 (+0%)
Mutual labels:  twitter-api
kafka-twitter-spark-streaming
Counting Tweets Per User in Real-Time
Stars: ✭ 38 (-25.49%)
Mutual labels:  twitter-api
kuon
🐦 [WIP] Twitter Client Library written in Rust 🦀
Stars: ✭ 47 (-7.84%)
Mutual labels:  twitter-api
twitter-stream-rs
A Rust library for listening on Twitter Streaming API.
Stars: ✭ 66 (+29.41%)
Mutual labels:  twitter-api

Getting Started Build Status Scrutinizer Status

Installation

# installing the latest signed release
composer require hborras/twitter-php-ads-sdk

Quick Start

const CONSUMER_KEY = 'your consumer key';
const CONSUMER_SECRET = 'your consumer secret';
const ACCESS_TOKEN = 'access token';
const ACCESS_TOKEN_SECRET = 'access token secret';
const ACCOUNT_ID = 'account id';


// Create Twitter Ads Api Instance
$api = TwitterAds::init(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);

$accounts = $api->getAccounts();
// load up the account instance, campaign and line item
$account = new Account(ACCOUNT_ID);
$account->read();
$campaigns = $account->getCampaigns('', [CampaignFields::COUNT => 1]);
$campaigns->setUseImplicitFetch(false);
$campaignsData = [];

// Create your campaign

$fundingInstruments = $account->getFundingInstruments();
$fundingInstrument = $fundingInstruments->getCollection()[0];

$campaign = new Campaign();
$campaign->setFundingInstrumentId($fundingInstrument->getId());
$campaign->setDailyBudgetAmountLocalMicro(1000000);
$campaign->setName("My first campaign: ");
$campaign->setEntityStatus('PAUSED');
$campaign->setStartTime(new \DateTime());
$campaign->save();

// Automatic fetch from API when collection arrives to end:
$campaign->setUseImplicitFetch(true);

// Default fetch from API when collection arrives to end (GLOBAL):
Cursor::setDefaultUseImplicitFetch(true);

// Disable it
Cursor::setDefaultUseImplicitFetch(false);

// Async stats
$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
);

// Sync stats, set parameter to false, or not include it
$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
    ], false
);

Field Constants

Now, there are able Fields classes for every included class to make easier filter and create data .. code:: php AnalyticsFields::GRANULARITY -> 'granularity' AnalyticsFields::PLACEMENT -> 'placement' . . .

Development

If you’d like to contribute to the project or try an unreleased development version of this project locally, you can do so quite easily by following the examples below.

# clone the repository
git clone [email protected]:hborras/twitter-php-ads-sdk.git
cd twitter-php-ads-sdk

# install dependencies
composer install

License

The MIT License (MIT)

Copyright (c) 2019 Hector Borras

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

target:https://travis-ci.org/hborras/twitter-php-ads-sdk
target:https://scrutinizer-ci.com/g/hborras/twitter-php-ads-sdk
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].