codenamephp/platform.github

This package is abandoned and no longer maintained. No replacement package was suggested.

0.1 2016-04-04 21:09 UTC

This package is auto-updated.

Last update: 2020-08-18 20:03:59 UTC


README

Component to access the github API base on https://github.com/KnpLabs/php-github-api

#Installation Just add the package to composer:

...
  "require": {
    "php": ">=7",
    "codenamephp/platform.github": "*"
  },
...

Then add the \de\codenamephp\platform\github\DefinitionProvider to the DI Container:

$containerBuilder = new \de\codenamephp\platform\di\ContainerBuilder();
$containerBuilder->addDefinitionsByProvider(new \de\codenamephp\platform\github\DefinitionProvider());
return $containerBuilder;

#Usage ##Authentication Github requires authentication before making any API calls. There are several authentication methods available. A complete list and documentation can be found in the github help: https://developer.github.com/v3/oauth_authorizations/ and https://developer.github.com/v3/auth/ ###API Token (https://github.com/blog/1509-personal-api-tokens) To authenticate via API Token, just request a de\codenamephp\platform\github\ApiToken from the DI container and call authenticate():

$diContainer->get(de\codenamephp\platform\github\ApiToken::class)->authenticate();

The github.apiToken entry needs to be set in the DI Container, otherwise the instance cannot be created.