dmyers/octogun

Simple wrapper for the GitHub v3 API

Installs: 40

Dependents: 0

Stars: 6

Watchers: 2

Forks: 1

Language: PHP

v0.0.2 2015-04-11 18:33 UTC

README

Simple PHP wrapper for the GitHub API. This is an unofficial port of Octokit.rb in PHP. The goal is to have feature parity between languages.

Installation

Simply add the following to your composer.json require block:

'dmyers/octogun'

Examples

Show a user
$client = \Octogun\Octogun::users();
$client->user('sferik');
Show a repository
$client = \Octogun\Octogun::repositories();
$client->repo('octogun/octogun.rb');
Authenticated Requests

For methods that require authentication, you'll need to setup a client with your login and password.

$client = new \Octogun\Client(array('login' => 'me', 'password' => 'sekret'));
$client->users()->follow('sferik');

Alternately, you can authenticate with a GitHub OAuth2 token.

$client = new \Octogun\Client(array('login' => 'me', 'oauth_token' => 'oauth2token'));
$client->users()->follow('sferik');

Using with GitHub Enterprise

To use with GitHub Enterprise, you'll need to set the API and web endpoints before instantiating a client.

$client = new \Octogun\Client(array('login' => 'USERNAME', 'password' => 'PASSWORD'));
$client->configuration()->set('api_endpoint', 'https://github.company.com/api/v3';
$client->configuration()->set('web_endpoint', 'https://github.company.com/';

Copyright

Copyright (c) 2013 Derek Myers. See LICENSE for details.