2017 © Pedro Peláez
 

library twitter-rest-api

Classes that interface with Twitter REST API v1.1 using Application-only authentication

image

tang/twitter-rest-api

Classes that interface with Twitter REST API v1.1 using Application-only authentication

  • Sunday, March 9, 2014
  • by skaterdav85
  • Repository
  • 3 Watchers
  • 2 Stars
  • 23 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Twitter API Library for Applications

Install

You can install this package through Composer:, (*1)

https://packagist.org/packages/tang/twitter-rest-api, (*2)

Getting Started

Visit https://dev.twitter.com/apps/ to define an application on Twitter and save your API key information., (*3)

Currently this library only supports application-only authentication. This means that any request to the API for endpoints that require user context, such as posting tweets, will not work., (*4)

Searching tweets

$twitterSearch = new Tang\TwitterRestApi\TwitterApi([
    'api_key' => API_KEY,
    'api_secret' => API_SECRET
]);

$json = $twitterSearch->authenticate()->get('search/tweets', [
    'q' => 'laravel'
]);

You can pass in a 3rd argument to the TwitterApi::get() and this will return the JSON decoded., (*5)

Getting a user's timeline

$twitterApi = new Tang\TwitterRestApi\TwitterApi([
    'api_key' => API_KEY,
    'api_secret' => API_SECRET
]);

$json = $twitterApi->authenticate()->get('statuses/user_timeline', [
    'screen_name' => 'uscitp',
    'count' => 10,
    'exclude_replies' => true
]);

You can pass in any application level base route to the get method along with query string params passed as an array., (*6)

Working Examples

See the examples folder for working examples, (*7)

The Versions

09/03 2014

dev-master

9999999-dev

Classes that interface with Twitter REST API v1.1 using Application-only authentication

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by David Tang

twitter api