Github
, (*1)
Github Webservice (API) for CakePHP 3., (*2)
Install
Using Composer:, (*3)
composer require muffin/github:dev-master
You then need to load the plugin. You can use the shell command:, (*4)
bin/cake plugin load Muffin/Github
or by manually adding statement shown below to boostrap.php
:, (*5)
Plugin::load('Muffin/Github');
Usage
In your app.php
, configure your github
service like any other configuration, by adding a new element to the configure array:, (*6)
'Webservices' => [
'github' => [
'className' => 'Muffin\Webservice\Connection',
'service' => 'Muffin/Github.Github',
]
]
or, to use a token for example (and full namespaced driver):, (*7)
'Webservices' => [
'github' => [
'className' => 'Muffin\Webservice\Connection',
'service' => 'Muffin\Github\Webservice\Driver\Github',
'token' => env('GITHUB_TOKEN'),
]
]
or using your username/password combination:, (*8)
'Webservices' => [
'github' => [
'className' => 'Muffin\Webservice\Connection',
'service' => 'Muffin/Github.Github',
'username' => env('GITHUB_USERNAME'),
'password' => env('GITHUB_PASSWORD'),
]
]
or using your client ID and secret:, (*9)
'Webservices' => [
'github' => [
'className' => 'Muffin\Webservice\Connection',
'service' => 'Muffin/Github.Github',
'clientId' => env('GITHUB_CLIENT_ID'),
'secret' => env('GITHUB_SECRET'),
]
]
You will also need to load the webservices if you haven't already done that in your
bootstrap.php
file:, (*10)
ConnectionManager::config(Configure::consume('Webservices'));
Now, from anywhere, you could call the webservice like so:, (*11)
$connection = ConnectionManager:get('github');
$repo = $connection->api('repo')->show('usemuffin', 'github');
Patches & Features
- Fork
- Mod, fix
- Test - this is important, so it's not unintentionally broken
- Commit - do not mess with license, todo, version, etc. (if you do change any, bump them into commits of
their own that I can ignore when I pull)
- Pull request - bonus point for topic branches
To ensure your PRs are considered for upstream, you MUST follow the CakePHP coding standards., (*12)
Bugs & Feedback
http://github.com/usemuffin/github/issues, (*13)
License
Copyright (c) 2015, [Use Muffin] and licensed under The MIT License., (*14)