https://github.com/socialconnect/github
GitHub SDK
https://github.com/socialconnect/github
Last synced: about 2 months ago
JSON representation
GitHub SDK
- Host: GitHub
- URL: https://github.com/socialconnect/github
- Owner: SocialConnect
- Created: 2014-08-27T09:46:11.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-10-10T11:10:19.000Z (over 10 years ago)
- Last Synced: 2024-10-29T21:06:00.413Z (over 1 year ago)
- Language: PHP
- Homepage: https://sc.dmtry.me/
- Size: 199 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#
GitHub SDK
[](https://travis-ci.org/SocialConnect/github)
[](https://scrutinizer-ci.com/g/SocialConnect/github/?branch=master)
[](https://scrutinizer-ci.com/g/SocialConnect/github/?branch=master)
[](https://packagist.org/packages/socialconnect/github)
[](https://packagist.org/packages/socialconnect/github)
> Awesome SDK to work with [GitHub](https://developer.github.com/)
Available methods:
| API | Methods | Documentation | Specification tests |
|--------------|------------------------------------------------------------------------------------------------|--------------------|---------------------|
| Repositories | | 0/15 :x: | |
| | [getRepositories](https://developer.github.com/v3/repos/#list-your-repositories) | :x: | :x: |
| | [getUserRepositories](https://developer.github.com/v3/users/#get-the-authenticated-user) | :x: | :x: |
| | [getOrgRepositories](https://developer.github.com/v3/users/#update-the-authenticated-user) | :x: | :x: |
| Users | | 2/4 :x: | |
| | [getUser](https://developer.github.com/v3/users/#get-a-single-user) | :heavy_check_mark: | :heavy_check_mark: |
| | [getSelf](https://developer.github.com/v3/users/#get-the-authenticated-user) | :x: | :x: |
| | [updateUser](https://developer.github.com/v3/users/#update-the-authenticated-user) | :x: | :x: |
| | [getUsers](https://developer.github.com/v3/users/#get-all-users) | :heavy_check_mark: | :heavy_check_mark: |
## OAuth/WebHook
This library is a Client only, see:
OAuth provider in [socialconnect/auth](https://github.com/socialconnect/auth) project.
Github WebHook Service in [ovr/github-webhook-service](https://github.com/ovr/github-webhook-service) project.
## Installation
Add a requirement to your `composer.json`:
```json
{
"require": {
"socialconnect/github": "~0.1"
}
}
```
Run the composer installer:
```bash
php composer.phar install
```
How to use
----------
First you need to create service:
```php
// Your GitHub Application's settings
$appId = 'appId';
$appSecret = 'secret';
$ghClient = new \SocialConnect\GitHub\Client($appId, $appSecret);
$ghClient->setHttpClient(new \SocialConnect\Common\Http\Client\Curl());
```
## Get user with specified $id:
```php
$ghClient = $ghClient->getUser('ovr');
var_dump($user);
```
## Customs methods
```php
$parameters = [];
$result = $ghClient->request('method/CustomMethod', $parameters);
if ($result) {
var_dump($result);
}
```
## Custom entities
```php
class MyUserEntitiy extends \SocialConnect\GitHub\Entity\User {
public function myOwnMethod()
{
//do something
}
}
$ghClient->getEntityUser(new MyUserEntitiy());
$user = $ghClient->getUser(1);
if ($user) {
$ghClient->myOwnMethod();
}
```
License
-------
This project is open-sourced software licensed under the MIT License. See the LICENSE file for more information.