muffin/github

Github Webservice (API) for CakePHP 3.

Installs: 1 174

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 2

Type:cakephp-plugin

1.0 2016-05-31 18:24 UTC

This package is auto-updated.

Last update: 2024-10-28 01:41:21 UTC


README

Build Status Coverage Total Downloads License

Github Webservice (API) for CakePHP 3.

Install

Using Composer:

composer require muffin/github:dev-master

You then need to load the plugin. You can use the shell command:

bin/cake plugin load Muffin/Github

or by manually adding statement shown below to boostrap.php:

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:

    'Webservices' => [
        'github' => [
            'className' => 'Muffin\Webservice\Connection',
            'service' => 'Muffin/Github.Github',
        ]
    ]

or, to use a token for example (and full namespaced driver):

    'Webservices' => [
        'github' => [
            'className' => 'Muffin\Webservice\Connection',
            'service' => 'Muffin\Github\Webservice\Driver\Github',
            'token' => env('GITHUB_TOKEN'),
        ]
    ]

or using your username/password combination:

    '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:

    '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:

ConnectionManager::config(Configure::consume('Webservices'));

Now, from anywhere, you could call the webservice like so:

$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.

Bugs & Feedback

http://github.com/usemuffin/github/issues

License

Copyright (c) 2015, [Use Muffin] and licensed under The MIT License.