Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A minimalist PHP Twitter API.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
README

README

A minimalist PHP Twitter API.
Inspired by Mike Verdone's <http://mike.verdone.ca> Python Twitter Tools


Public (unauthenticated) methods:

$twitter = new Twitter;

// Get the public timeline.
$entries = $twitter->statuses->public_timeline();

// Search.
$twitter->search(array('q' => 'foo'));


Protected (authenticated) methods:

$twitter = new Twitter('username', 'password');

// Get page two of the user's followers.
$entries = $twitter->statuses->followers(array('page' => 2));

// Send a direct message.
$twitter->direct_messages->new(array('user' => 12345, 'text' => 'foo'));

// View your lists. (Unfortunately, Twitter has adopted an inconsistent way 
// of exposing the list resources that doesn't quite fit our model.)
$twitter->{'username'}->lists();


Retrieving results in another format and setting the user agent string:

$twitter = new Twitter('username', 'password', array(
    'format' => "xml", 
    'user_agent' => "my-application/0.1"
));

-or-

$twitter = new Twitter;
$twitter->set_option('format', "XML");
$twitter->set_option('user_agent', "my-application/0.1");

Something went wrong with that request. Please try again.