Skip to content

Commit 3c36776

Browse files
committed
Add guzzle events to customize.md
1 parent ee45d48 commit 3c36776

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

doc/customize.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@ $client->getHttpClient()->setOption('user_agent', 'My new User Agent');
1111

1212
See all available options in `Github/HttpClient/HttpClient.php`
1313

14+
### Guzzle events
15+
16+
If you need to perform any special action on request/response use guzzle events:
17+
18+
```php
19+
use Guzzle\Common\Event;
20+
use Github\HttpClient\Message\ResponseMediator;
21+
22+
$client->getHttpClient()->addListener('request.success', function(Event $event) {
23+
$remaining = ResponseMediator::getApiLimit($event['response']);
24+
25+
var_dump($remaining);
26+
});
27+
28+
$client->user()->show('cursedcoder');
29+
```
30+
31+
see list of events http://guzzle3.readthedocs.org/http-client/request.html#plugins-and-events
32+
1433
### Inject a new http client instance
1534

1635
`php-github-api` provides a curl-based implementation of a http client.

0 commit comments

Comments
 (0)