Skip to content

Commit

Permalink
fix: add method to get previous response (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
atymic authored Jun 22, 2020
1 parent 909d2b0 commit 071ea84
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ format : object|json|array (default:object)

## Helper Functions

Get Last Response: Get the last response from twitter. For example, you can access the headers to check your rate limit quota.
```php
$res = Twitter::getLastResponse();
var_dump($res['headers']); // ['Rate-Limit' => 'Whatever']
```

Linkify : Transforms URLs, @usernames, hashtags into links.
The type of $tweet can be object, array or text.
By sending an object or an array the method will expand links (t.co) too.
Expand Down
8 changes: 8 additions & 0 deletions src/Thujohn/Twitter/Twitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,14 @@ public function delete($name, $parameters = [], $multipart = false, $extension =
return $this->query($name, 'DELETE', $parameters, $multipart, $extension, $appOnly);
}

/**
* Get the last response from twitter.
*/
public function getLastResponse()
{
return $this->response;
}

public function linkify($tweet)
{
return Utils::linkify($tweet);
Expand Down

0 comments on commit 071ea84

Please sign in to comment.