All Projects → J7mbo → Twitter Api Php

J7mbo / Twitter Api Php

Licence: mit
The simplest PHP Wrapper for Twitter API v1.1 calls

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to Twitter Api Php

Twitter.jl
Julia package to access Twitter API
Stars: ✭ 58 (-96.79%)
Mutual labels:  twitter-api, twitter-client, twitter
Surfbird
A Microblogging client built on Electron and Vue
Stars: ✭ 309 (-82.91%)
Mutual labels:  twitter-api, twitter-client, twitter
Awesome Twitter Tools
A curated list of awesome twitter tools
Stars: ✭ 113 (-93.75%)
Mutual labels:  twitter-api, twitter-client, twitter
Twitteroauth
The most popular PHP library for use with the Twitter OAuth REST API.
Stars: ✭ 4,134 (+128.65%)
Mutual labels:  twitter-api, twitter, twitter-oauth
Harpy
A Twitter app built with Flutter
Stars: ✭ 211 (-88.33%)
Mutual labels:  twitter-api, twitter-client, twitter
Twitterapi
Minimal python wrapper for Twitter's REST and Streaming APIs
Stars: ✭ 724 (-59.96%)
Mutual labels:  twitter-api, twitter-client, twitter
Talon For Twitter Android
The most powerful and beautiful Twitter client available.
Stars: ✭ 1,022 (-43.47%)
Mutual labels:  twitter-api, twitter
Likelo
Twitter auto like bot, Under Development👷, Pre Alpha
Stars: ✭ 64 (-96.46%)
Mutual labels:  twitter-api, twitter
Csscreatures
Make a creature by tweeting to @csscreatures
Stars: ✭ 144 (-92.04%)
Mutual labels:  twitter-api, twitter
Yourfukurou
Hackable YoruFukurou alternative Twitter client
Stars: ✭ 85 (-95.3%)
Mutual labels:  twitter-client, twitter
Node Twitter Api
Twitter API 1.1 client for NodeJS
Stars: ✭ 29 (-98.4%)
Mutual labels:  twitter-api, twitter
21 Recipes
📕 An R/rtweet edition of Matthew A. Russell's Python Twitter Recipes Book
Stars: ✭ 69 (-96.18%)
Mutual labels:  twitter-api, twitter
Tia
Your Advanced Twitter stalking tool
Stars: ✭ 98 (-94.58%)
Mutual labels:  twitter-api, twitter
Tweepy
Twitter for Python!
Stars: ✭ 8,293 (+358.68%)
Mutual labels:  twitter-api, twitter
Autohook
Automatically setup and serve webhooks for the Twitter Account Activity API
Stars: ✭ 67 (-96.29%)
Mutual labels:  twitter-api, twitter
Rtweet Workshop
Slides and code for the rtweet workshop
Stars: ✭ 41 (-97.73%)
Mutual labels:  twitter-api, twitter
Tweetview
This project is an example Android Twitter feed reader app from the Codehenge Android development tutorials.
Stars: ✭ 75 (-95.85%)
Mutual labels:  twitter-api, twitter
Twitterbot
Several PHP scripts for making Twitter bots that retweet certain terms, or post from a data source (rss, database, markov body, picture folder).
Stars: ✭ 106 (-94.14%)
Mutual labels:  twitter-api, twitter
Twitter Python Ads Sdk
A Twitter supported and maintained Ads API SDK for Python.
Stars: ✭ 114 (-93.69%)
Mutual labels:  twitter-api, twitter
Twurl
OAuth-enabled curl for the Twitter API
Stars: ✭ 1,648 (-8.85%)
Mutual labels:  twitter-api, twitter

twitter-api-php

Simple PHP Wrapper for Twitter API v1.1 calls

Total Downloads Build Status Version

Changelog || Examples || Wiki

Instructions in StackOverflow post here with examples. This post shows you how to get your tokens and more. If you found it useful, please upvote / leave a comment! :)

The aim of this class is simple. You need to:

You really can't get much simpler than that. The above bullet points are an example of how to use the class for a POST request to block a user, and at the bottom is an example of a GET request.

Installation

Normally: If you don't use composer, don't worry - just include TwitterAPIExchange.php in your application.

require_once('TwitterAPIExchange.php');

Via Composer:

composer require j7mbo/twitter-api-php

How To Use

Set access tokens

$settings = array(
    'oauth_access_token' => "YOUR_OAUTH_ACCESS_TOKEN",
    'oauth_access_token_secret' => "YOUR_OAUTH_ACCESS_TOKEN_SECRET",
    'consumer_key' => "YOUR_CONSUMER_KEY",
    'consumer_secret' => "YOUR_CONSUMER_SECRET"
);

Choose URL and Request Method

$url = 'https://api.twitter.com/1.1/blocks/create.json';
$requestMethod = 'POST';

Choose POST fields (or PUT fields if you're using PUT)

$postfields = array(
    'screen_name' => 'usernameToBlock', 
    'skip_status' => '1'
);

Perform the request!

$twitter = new TwitterAPIExchange($settings);
echo $twitter->buildOauth($url, $requestMethod)
    ->setPostfields($postfields)
    ->performRequest();

GET Request Example

Set the GET field BEFORE calling buildOauth(); and everything else is the same:

$url = 'https://api.twitter.com/1.1/followers/ids.json';
$getfield = '?screen_name=J7mbo';
$requestMethod = 'GET';

$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
    ->buildOauth($url, $requestMethod)
    ->performRequest();

That is it! Really simple, works great with the 1.1 API. Thanks to @lackovic10 and @rivers on SO!

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].