codenamephp / platform.github
Requires
- php: >=7
- codenamephp/platform.core: ^1
- codenamephp/platform.di: ^2
- knplabs/github-api: ~1
Requires (Dev)
- codenamephp/platform.test: ^2
- pdepend/pdepend: 1.0.7
- phing/phing: 2.9.*
- phpdocumentor/phpdocumentor: 2.8.*
- phploc/phploc: 2.0.*
- phpmd/phpmd: 1.4.*
- sebastian/phpcpd: 2.0.*
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.