PHP Class Twitter, twitter-php

Show file Open project: dg/twitter-php Class Usage Examples

Public Properties

Property Type Description
$cacheDir string
$cacheExpire integer
$httpOptions array

Public Methods

Method Description
__construct ( $consumerKey, $consumerSecret, $accessToken = NULL, $accessTokenSecret = NULL ) Creates object using consumer and access keys.
authenticate ( ) : boolean Tests if user credentials are valid.
cachedRequest ( $resource, array $data = NULL, $cacheExpire = NULL ) : stdClass | stdClass[] Cached HTTP request.
clickable ( stdClass $status ) : string Makes twitter links, @usernames and #hashtags clickable.
destroy ( $id ) : mixed Destroys status.
follow ( $username ) : stdClass Follows a user on Twitter.
load ( $flags = self::ME, $count = 20, array $data = NULL ) : stdClass[] Returns the most recent statuses.
loadUserFollowers ( $username, $count = 5000, $cursor, $cacheExpiry = null ) : stdClass Returns IDs of followers of a given user.
loadUserFollowersList ( $username, $count = 200, $cursor, $cacheExpiry = null ) : stdClass Returns list of followers of a given user.
loadUserInfo ( $username ) : stdClass Returns information of a given user.
loadUserInfoById ( $id ) : stdClass Returns information of a given user by id.
request ( $resource, $method, array $data = NULL, array $files = NULL ) : stdClass | stdClass[] Process HTTP request.
search ( $query, $full = FALSE ) : stdClass Returns tweets that match a specified query.
send ( $message, $media = NULL ) : stdClass Sends message to the Twitter.
sendDirectMessage ( $username, $message ) : stdClass Sends a direct message to the specified user.

Method Details

__construct() public method

Creates object using consumer and access keys.
public __construct ( $consumerKey, $consumerSecret, $accessToken = NULL, $accessTokenSecret = NULL )

authenticate() public method

Tests if user credentials are valid.
public authenticate ( ) : boolean
return boolean

cachedRequest() public method

Cached HTTP request.
public cachedRequest ( $resource, array $data = NULL, $cacheExpire = NULL ) : stdClass | stdClass[]
$data array
return stdClass | stdClass[]

clickable() public static method

Makes twitter links, @usernames and #hashtags clickable.
public static clickable ( stdClass $status ) : string
$status stdClass
return string

destroy() public method

Destroys status.
public destroy ( $id ) : mixed
return mixed

follow() public method

Follows a user on Twitter.
public follow ( $username ) : stdClass
return stdClass see https://dev.twitter.com/rest/reference/post/friendships/create

load() public method

Returns the most recent statuses.
public load ( $flags = self::ME, $count = 20, array $data = NULL ) : stdClass[]
$data array
return stdClass[]

loadUserFollowers() public method

Returns IDs of followers of a given user.
public loadUserFollowers ( $username, $count = 5000, $cursor, $cacheExpiry = null ) : stdClass
return stdClass see https://dev.twitter.com/rest/reference/get/followers/ids

loadUserFollowersList() public method

Returns list of followers of a given user.
public loadUserFollowersList ( $username, $count = 200, $cursor, $cacheExpiry = null ) : stdClass
return stdClass see https://dev.twitter.com/rest/reference/get/followers/list

loadUserInfo() public method

Returns information of a given user.
public loadUserInfo ( $username ) : stdClass
return stdClass see https://dev.twitter.com/rest/reference/get/users/show

loadUserInfoById() public method

Returns information of a given user by id.
public loadUserInfoById ( $id ) : stdClass
return stdClass see https://dev.twitter.com/rest/reference/get/users/show

request() public method

Process HTTP request.
public request ( $resource, $method, array $data = NULL, array $files = NULL ) : stdClass | stdClass[]
$data array
$files array
return stdClass | stdClass[]

send() public method

Sends message to the Twitter.
public send ( $message, $media = NULL ) : stdClass
return stdClass see https://dev.twitter.com/rest/reference/post/statuses/update

sendDirectMessage() public method

Sends a direct message to the specified user.
public sendDirectMessage ( $username, $message ) : stdClass
return stdClass see https://dev.twitter.com/rest/reference/post/direct_messages/new

Property Details

$cacheDir public static property

public static string $cacheDir
return string

$cacheExpire public static property

public static int $cacheExpire
return integer

$httpOptions public property

public array $httpOptions
return array