-
Notifications
You must be signed in to change notification settings - Fork 53
Home
Miloslav Hůla edited this page May 14, 2014
·
4 revisions
This library helps you to access Github API. It is quite low-level library. All data are returned in the same raw form as Github describes them at documentation page. None envelope classes.
So what the library does? It helps you to:
- obtain OAuth token
- define/read HTTP headers in a sane way
- encode/decode JSON data
- observe incoming and outgoing HTTP activity
- cache requests to save the rate-limit
The heard of the library is the Milo\Github\Api class. Within this class you access the API by GET
, POST
, HEAD
, PUT
... HTTP methods.
$api = new Milo\Github\Api;
# Get all available emoticon URLs example
$response = $api->get('/emojis');
$emojis = $api->decode($response);
# Render a Markdown document example
$data = [
'text' => 'Check out this commit e41d17e4a4a9e5368e018fcac44ff42155bc8738',
'mode' => 'gfm',
'context' => 'milo/github-api',
];
$response = $api->post('/markdown', $data);
$html = $api->decode($response);
And that's actually all. You can find details about library API on other wiki pages.