jimbojsb/github-repo-events

A standalone client for parsing the Github Repo Events API

v0.1.2 2017-02-17 17:15 UTC

This package is auto-updated.

Last update: 2024-11-18 05:32:23 UTC


README

This library will allow you to poll the Github events API rather than using a web hook.

Usage

Basic usage on a public repo

$eventsStream = new GithubRepoEvents\RepsitoryEventStream("user/repo");
foreach ($eventsStream as $event) {
    // do stuff with events
}

Add an API key for increased quota or access to private repos

$eventsStream = new GithubRepoEvents\RepsitoryEventStream("user/repo", "githubApiKey");
foreach ($eventsStream as $event) {
    // do stuff with events
}

Use ETags to avoid quota hits

// costs from quota
$eventsStream = new GithubRepoEvents\RepsitoryEventStream("user/repo", "githubApiKey");
foreach ($eventsStream as $event) {
    // do stuff with events
}

$etag = $eventStream->getEtag();

// does not cost from quota, assuming the stream has no new events
$eventsStream = new GithubRepoEvents\RepsitoryEventStream("user/repo", "githubApiKey");
$eventStream->setEtag($etag);
foreach ($eventsStream as $event) {
    // do stuff with events
}