PHP code example of localheinz / github-changelog

1. Go to this page and download the library: Download localheinz/github-changelog 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/ */

    

localheinz / github-changelog example snippets




ithub\Client;
use Github\HttpClient\CachedHttpClient;
use Ergebnis\GitHub\Changelog\Repository;
use Ergebnis\GitHub\Changelog\Resource;

$client = new Client(new CachedHttpClient());
$client->authenticate(
    'your-token-here',
    Client::AUTH_HTTP_TOKEN
);

$pullRequestRepository = new Repository\PullRequestRepository(
    $client->pullRequests(),
    new Repository\CommitRepository($client->repositories()->commits())
);

/* @var Resource\RangeInterface $range */
$range = $repository->items(
    Resource\Repository::fromString('ergebnis/github-changelog'),
    '0.1.1',
    '0.1.2'
);

$pullRequests = $range->pullRequests();

array_walk($pullRequests, function (Resource\PullRequestInterface $pullRequest) {
    echo sprintf(
        '- %s (#%d), submitted by @%s' . PHP_EOL,
        $pullRequest->title(),
        $pullRequest->number(),
        $pullRequest->author()->login(),
    );
});