Tweets

$twitter = new BirdElephant($credentials);

$tweets = $twitter->tweets();

Tweet

Tweets a tweet object, with media or a poll. Can quote retweet and reply to tweets. See Manage Tweets for full implementation details and examples;

$tweets->tweet($tweet);
Auth: OAuth 1.0 User Context
NameTypeDescription
$tweetobjectThe Tweet object - see Manage Tweetsrequired

Delete Tweet

Deletes a tweet on behalf of the authenticated user

$tweets->delete($tweet_id);
Auth: OAuth 1.0 User Context
NameTypeDescription
$tweet_idStringThe Tweet idrequired

Get Tweet

Gets a tweet

$tweets->get($tweet_id, $params);
Auth: OAuth 2.0 Bearer token
NameTypeDescription
$tweet_idStringThe Tweet idrequired
$paramsArrayQuery Parametersoptional

Lookup Tweets

Gets multiple tweets

$tweet_ids = [$id1,$id2]
$tweets->lookup($tweet_ids, $params);
Auth: OAuth 2.0 Bearer token
NameTypeDescription
$tweet_idsArrayThe Tweet idsrequired
$paramsArrayQuery Parametersoptional

Count Recent Tweets

Gets a count of Tweets that match a query in the last 7 days.

$params = [
    'query' => 'Schlager',
];

$tweets->count()->recent($params);
Auth: OAuth 2.0 Bearer token
NameTypeDescription
$paramsArrayQuery Parametersrequired

Count All Tweets

Gets a count of Tweets that match a query. Academic track only.

$params = [
    'query' => 'Dieter Thomas Heck',
];

$tweets->count()->all($params);
Auth: OAuth 2.0 Bearer token
NameTypeDescription
$paramsArrayQuery Parametersrequired

Search Recent Tweets

Search Tweets that match a query in the last 7 days.

$params = [
    'query' => 'limerick has:images ',
    'tweet.fields' => 'attachments,author_id,created_at',
    'expansions'   => 'attachments.media_keys',
    'media.fields' => 'public_metrics,type,url,width',
    'max_results'  => 10,
];

$tweets->search()->recent($params);
Auth: OAuth 2.0 Bearer token
NameTypeDescription
$paramsArrayQuery Parametersrequired

Search All Tweets

Search Tweets that match a query. Academic track only.

$params = [
    'query' => 'Schlager has:images',
];

$tweets->search()->all($params);
Auth: OAuth 2.0 Bearer token
NameTypeDescription
$paramsArrayQuery Parametersrequired

Hide Reply

Hide a reply to a tweet

// note: you can't hide your own replies!!
$tweets->reply()->hide($id);
Auth: OAuth 1.0a User context
NameTypeDescription
$idStringThe Tweet idrequired

Unhide Reply

unhide a reply to a tweeet

$tweets->reply()->unhide($id);
Auth: OAuth 1.0a User context
NameTypeDescription
$idStringThe Tweet idrequired

Tweet Likers

Get the users who have liked a given tweet

$tweets->likers($tweet_id, $params);
Auth: OAuth 2.0 Bearer token
NameTypeDescription
$tweet_idStringThe Tweet idrequired
$paramsArrayQuery Parametersoptional

Tweet Retweeters

Get the users who have liked a given tweet

$tweets->retweeters($tweet_id, $params);
Auth: OAuth 2.0 Bearer token
NameTypeDescription
$tweet_idStringThe Tweet idrequired
$paramsArrayQuery Parametersoptional
Edit this page on GitHub Updated at Wed, Jun 15, 2022