Users
Returns information about a user or group of users
Twitter Users
users()
Method: Returns information about a group of users
$twitter = new BirdElephant($credentials);
$users = $twitter->users()
Lookup Users
lookup()
Method: Looks up multiple twitter users by username
$usernames = ['coderjerk', 'kennyg', 'dril'];
$params = [
'expansions' => 'pinned_tweet_id',
'user.fields' => 'created_at,description,entities,id,location'
];
$users->lookup($usernames, $params);
Argument | Type | Description | |
---|---|---|---|
$usernames | Array | array of Twitter usernames | required |
$params | Array | available query parameters | optional |
Me
me()
Method: Get the authenticated user
$twitter = new BirdElephant($credentials);
$me = $twitter->me()
myself()
Method: Gets information about the authenticated user.
$params = [
'expansions' => 'pinned_tweet_id',
];
$me->myself($params);
Argument | Type | Description | |
---|---|---|---|
$params | Array | available query parameters | optional |
Twitter User
user()
Method: Sets up a Twitter user by user name to be used in conjunction with the methods below to perform actions on behalf of and retrieve data about the named user. The named user must be the authenticated user in instances where user context auth is required.
$twitter = new BirdElephant($credentials);
$user = $twitter->user($user_name);
Argument | Type | Description | |
---|---|---|---|
$user_name | String | Twitter username | required |
Get User
get()
Method: Gets information about the named Twitter user.
$user->get();
Argument | Type | Description | |
---|---|---|---|
$params | Array | available query parameters | optional |
Get Followers
followers()
Method: Gets a Twitter user's followers
$user->followers();
Argument | Type | Description | |
---|---|---|---|
$params | Array | available query parameters | optional |
Get Following
following()
Method: Gets a Twitter user's followed accounts
$params= [
'max_results' => 20,
'user.fields' => 'profile_image_url'
];
$user->following($params);
Argument | Type | Description | |
---|---|---|---|
$params | Array | available query parameters | optional |
Follow
follow()
Method: Follows a given user
$user->follow('coderjerk');
Argument | Type | Description | |
---|---|---|---|
$target_username | String | The target twitter username | required |
Unfollow
unfollow()
Method: Unfollows a given user
$user->unfollow('stefanmross');
Argument | Type | Description | |
---|---|---|---|
$target_username | String | The target twitter username | required |
Timeline
timeline()
Method: Gets the authenticated user's timeline in reverse chronological order.
$username = $twitter->me()->myself()->data->username;
$timeline = $twitter->user($username)->timeline();
Argument | Type | Description | |
---|---|---|---|
$params | Array | see Twitter docs for avilable query parameters | optional |
User Tweets
tweets()
Method: Gets the tweets of a Twitter user.
$user->tweets();
Argument | Type | Description | |
---|---|---|---|
$params | Array | see Twitter docs for avilable query parameters | optional |
Mentions
mentions()
Method: Gets the mentions of a Twitter user.
$user->mentions();
Argument | Type | Description | |
---|---|---|---|
$params | Array | see Twitter docs for avilable query parameters | optional |
User Blocks
blocks()
Method: Gets the blocked accounts of a Twitter user.
$user->blocks();
Argument | Type | Description | |
---|---|---|---|
$params | Array | see Twitter docs for avilable query parameters | optional |
Block User
block()
Method: Blocks a given user
$user->block('GilbertOSull_');
Argument | Type | Description | |
---|---|---|---|
$target_username | String | The target twitter username | required |
Unblock User
unblock()
Method: Unblocks a given user
$user->unblock('claydermanmusic');
Argument | Type | Description | |
---|---|---|---|
$target_username | String | The target twitter username | required |
User Mutes
mutes()
Method: Gets the muted accounts of a Twitter user.
$user->mutes();
Argument | Type | Description | |
---|---|---|---|
$params | Array | see Twitter docs for avilable query parameters | optional |
Mute User
mute()
Method: Mutes a given user
$user->mute('kennyg');
Argument | Type | Description | |
---|---|---|---|
$target_username | String | The target twitter username | required |
Unmute User
unmute()
Method: Unmutes a given user
$user->unmute('kennyg');
Argument | Type | Description | |
---|---|---|---|
$target_username | String | The target twitter username | required |
User Likes
likes()
Method: Gets the named user's last 100 likes
$user->likes($params);
Argument | Type | Description | |
---|---|---|---|
$params | Array | see Twitter docs for avilable query parameters | optional |
Like Tweet
like()
Method: Likes a tweet on behalf of the authenticated user
$user->like('1456978214837006343');
Argument | Type | Description | |
---|---|---|---|
$tweet_id | String | the target tweet id | reqired |
Unlike Tweet
unlike()
Method: Unlikes a tweet on behalf of the authenticated user
$user->unlike($tweet_id);
Argument | Type | Description | |
---|---|---|---|
$tweet_id | String | the target tweet id | required |
Retweet
retweet()
Method: Retweets a tweet on behalf of the authenticated user
$user->retweet('1456978214837006343');
Argument | Type | Description | |
---|---|---|---|
$tweet_id | String | the target tweet id | required |
Unretweet
unretweet()
Method: Unretweets a tweet on behalf of the authenticated user
$user->unretweet($tweet_id);
Argument | Type | Description | |
---|---|---|---|
$tweet_id | String | the target tweet id | required |
User Spaces
spaces()
Method: Gets a user's spaces
$user->spaces();
Argument | Type | Description | |
---|---|---|---|
$params | Array | see Twitter docs for avilable query parameters | optional |
User Lists
lists()
Method: Perform actions on lists on behalf of the authenticated user.
$user_lists = $user->lists();
Get Followed Lists
followed()
Method: Gets a list of folllowed lists on behalf of the authenticated user
$user_lists->followed($params);
Argument | Type | Description | |
---|---|---|---|
$params | Array | see Twitter docs for avilable query parameters | optional |
Get Pinned Lists
Gets a list of pinned lists on behalf of the authenticated user
$user_lists->pinned($params);
Argument | Type | Description | |
---|---|---|---|
$params | Array | see Twitter docs for avilable query parameters | optional |
Get Owned Lists
Gets lists owned by the authenticated user
$user_lists->owned($params);
Argument | Type | Description | |
---|---|---|---|
$params | Array | see Twitter docs for avilable query parameters | optional |
Follow Lists
Follows a list on behalf of the authenticated user
$user_lists->follow($target_list_id);
Argument | Type | Description | |
---|---|---|---|
$target_list_id | String | The target list id | required |
Unfollow Lists
Unfollows a list on behalf of the authenticated user
$user_lists->unfollow($target_list_id);
Argument | Type | Description | |
---|---|---|---|
$target_list_id | String | The target list id | required |
Pin Lists
Unpins a list on behalf of the authenticated user
$user_lists->pin($target_list_id);
Argument | Type | Description | |
---|---|---|---|
$target_list_id | String | The target list id | required |
Unpin Lists
Pins a list on behalf of the authenticated user
$user_lists->unpin($target_list_id);
Argument | Type | Description | |
---|---|---|---|
$target_list_id | String | The target list id | required |
Reference
Refer to the Twitter documentation for details of paramaters, expansions and fields.