PHP code example of jimbojsb / github-repo-events

1. Go to this page and download the library: Download jimbojsb/github-repo-events library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jimbojsb / github-repo-events example snippets


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

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

// 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
}