This extension allows you to perform Twitter API Calls to retrieve different type of data, With or without authentication, Using different formats for the returned data, that supports caching the returned data, parametrization requests, and user friendly errors.
Here are a few examples on using the Twitter extension.
- First make sure you've added the extension under the extensions directory located at: protected/extensions.
- Add the following array code to the components array in the application configuration file:
'twitter' => array( 'class' => 'application.extensions.twitter.VGTwitter', // path to the twitter extension 'username' => 'LOGINNAME', // login name, this is not required all the time but most api calls need this set 'apiCallType' => 'statuses/home_timeline', // the api call to perform, the default is set to statuses/user_timeline 'password' => 'PASSWORD', // password for the twitter account 'authenticate' => true, // if the twitter api call needs authentication then this must be set to true since by default it is set to false 'format' => 'rss', // default is xml so we will configure this as rss for this example 'postParams' => array( 'count' => 2 ) // we want only the first two results, meaning tweets ),
Then all we have to do in our code is to run the following:
$returned = Yii::app()->twitter->get()->getResponseData();
Now the $returned is an array/object/json depends on the format you chose to receive, that can be manipulated.
Change Log ¶
April 1, 2010 ¶
- Initial release.