guillermoandrae/php-github

A PHP client library for the GitHub API.

0.3.0 2015-03-11 02:08 UTC

This package is auto-updated.

Last update: 2024-10-29 04:59:06 UTC


README

Travis branch Coverage Status Code Quality HHVM

A PHP client library for the GitHub API.

Installation

The recommended way to install this library is via Composer:

{
    "require": {
        "guillermoandrae/php-github": "*"
    }
}

Basic Usage

The basic client uses Guzzle to communicate with the GitHub API. Instantiation of the client is straight-forward:

// create the client
$client = new GitHub\Client\Client();

Resources are represented as objects, and resource data is fetched through the use of object mappers:

// pick a resource and get some useful data, like so...
$users = $client->resource('user')->findAll();
foreach ($users as $user) {
    printf('%s has %d followers.', $user->getLogin(), $user->getNumFollowers());
    echo PHP_EOL;
}

// or like so...
$org = $client->resource('organization')->find('github');
echo $org->getLocation();

// .. and rejoice!
echo 'YEESSSSSSSSSSSS!';