Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmyers/octogun
Simple PHP wrapper for the GitHub API
https://github.com/dmyers/octogun
api client github php
Last synced: 27 days ago
JSON representation
Simple PHP wrapper for the GitHub API
- Host: GitHub
- URL: https://github.com/dmyers/octogun
- Owner: dmyers
- License: mit
- Created: 2013-06-08T06:29:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-09-10T16:07:49.000Z (about 5 years ago)
- Last Synced: 2024-10-09T09:51:00.539Z (about 1 month ago)
- Topics: api, client, github, php
- Language: PHP
- Size: 347 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Octogun [![Build Status](https://secure.travis-ci.org/dmyers/octogun.png?branch=master)](http://travis-ci.org/dmyers/octogun) [![Coverage Status](https://coveralls.io/repos/dmyers/octogun/badge.png)](https://coveralls.io/r/dmyers/octogun)
Simple PHP wrapper for the GitHub API. This is an unofficial port of [Octokit.rb](https://github.com/octokit/octokit.rb) in PHP. The goal is to have feature parity between languages.
## Installation
Simply install using composer:
```bash
$ composer require dmyers/octogun
```### Examples
#### Show a user
```php
$client = \Octogun\Octogun::users();
$client->user('sferik');
```#### Show a repository
```php
$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.```php
$client = new \Octogun\Client(['login' => 'me', 'password' => 'sekret']);
$client->users()->follow('sferik');
```Alternately, you can authenticate with a [GitHub OAuth2 token][oauth].
[oauth]: http://developer.github.com/v3/oauth
```php
$client = new \Octogun\Client(['login' => 'me', 'oauth_token' => 'oauth2token']);
$client->users()->follow('sferik');
```### Using with GitHub Enterprise
To use with [GitHub Enterprise](https://enterprise.github.com/), you'll need to
set the API and web endpoints before instantiating a client.```php
$client = new \Octogun\Client(['login' => 'USERNAME', 'password' => 'PASSWORD']);
$client->configuration()->set('api_endpoint', 'https://github.company.com/api/v3';
$client->configuration()->set('web_endpoint', 'https://github.company.com/';
```
## CopyrightCopyright (c) 2013 Derek Myers. See [LICENSE][] for details.
[license]: LICENSE.md