adamcbrewer / twitterapi

An OAuth 1.0A library written in PHP
1 stars 2 forks source link

Twitter API Interface

Getting Started

Install dependencies via composer:

$ composer install 

Create a php file with the following contents:

// Autoload composer files and require the API interface
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/twitterApi.php';

// Create a new instance
$twitter = new Twitter($config = array(
    'consumer_key'      => '',
    'consumer_secret'   => '',
    'user_token'        => '',
    'user_secret'       => '',
    'screen_name'       => ''
));

// Get the 10 latest tweets
// Consult the twitterApi.php file for more methods
$data = $twitter->get(10);

// Output as JSON
header('Content-Type: application/json');
echo json_encode($data);

Changelog