This is a simple Object Oriented wrapper for GitHub API v3, written with PHP7.
GitHub is a popular web-based Git repository hosting service, which offers all of the distributed revision control and source code management functionality of Git as well as adding its own features.
Since may 2013, GitHub announced Octokit, a new lineup of GitHub-maintained client libraries for the GitHub API. This means Octokit provide officially 3 libraries written in Ruby, Objective-C and .NET.
However, third-party libraries are available in other languages and particularly in PHP. At this time you can find at least 9 libraries to interact with GitHub API in PHP but none of this libraries provide a full support for all GitHub API features.
This library as been developed to help you to use all the features of GitHub API v3 easily as possible. This library, like the GitHub API is sparate in 2 distinct parts:
This library provide the next features:
To run this library in your web server, you’ll need the most recent PHP version of the branch 5.6.x. for some security and dependencies reasons.
This library is only compatible with PHP 5.6.1 or above. So please upgrade your PHP version if you have a lower version installed.
You will also need the cURL extension enabled in your web server.
This library use some dependencies to work with.
Here are the dependencies this library need to be installed with:
To get the latest version of this GitHub API library simply use composer.
$ php composer.phar require scion/githubapi
$ php composer.phar install
<?php // This file is generated by Composer require 'vendor/autoload.php'; // Create a Client object $client = new \Scion\GitHub\Client();
Webhooks allow you to build or set up integrations which subscribe to certain events on GitHub.com.
Complete documentation is available at https://developer.github.com/webhooks/.
For using a WebHook, you need an instance of
Scion\GitHub\WebHook class like:
<?php // This file is generated by Composer require 'vendor/autoload.php'; // Creating WebHook instance $webhook = new \Scion\GitHub\WebHook();
This library supports all authentications provided by the GitHub API v3. You can use the Basic Authentication, OAuth Token or the OAuth2 Key/Secret pair authentication for the Client and WebHook classes, like described here:
// Username only $client->setHttpAuth('username'); // Username & password $client->setHttpAuth('username', 'password');
Go to Authorized applications to
Generate new token, then you will be able to provide your 'token'.
// sent in userpwd $client->setToken('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); // sent in a header $client->setToken('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', \Scion\Github\Client::OAUTH2_HEADER_AUTH); // sent as a parameter $client->setToken('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', \Scion\Github\Client::OAUTH2_PARAMETERS_AUTH);
Go to Authorized applications to
Register new application, then you will be able to provide yours
$client->setClientId(''); // Set client_id $client->setClientSecret(''); // Set client_secret
You can find the full documentation of this library in the wiki section of the GitHub repository.
July 11, 2015
© 2013-2020 All rights reserved.
Built with Next.js. Designed with ♥ in Montreal