pulsestorm / php-github-api
是 KnpLabs/php-github-api 的包装器
1.0.2
2019-10-19 23:56 UTC
Requires
- knplabs/github-api: ^2.11
- php-http/guzzle6-adapter: ^1.1
This package is auto-updated.
Last update: 2024-09-19 22:23:23 UTC
README
这是一个 composer metapackage,它使得 优秀的 KnpLabs/php-github-api 包使用起来更加方便。
使用方法
只需运行
$ composer require pulsestorm/php-github-api
然后你应该就可以使用了。这个包将安装 knplabs/github-api
和默认的 php-http/guzzle6-adapter
适配器。安装好这些之后,你可以引入 composer 的自动加载器并开始编程。
<?php
// makes composer packages avaiable to your program -- if you're
// using a PHP framework with composer support this probably
// already happens.
require 'vendor/autoload.php';
$token = 'ab...3e'; # https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
$client = new \Github\Client();
$client->authenticate($token,null,\Github\Client::AUTH_HTTP_TOKEN);
// used the github API to download a file from the
// KnpLabs/php-github-api repository
$file = $client->api('repo')->contents()
->download('KnpLabs', 'php-github-api', 'composer.json');
echo "Downloaded","\n";
echo $file;
如果你需要更多帮助,实际的 项目仓库的 README.md 包含了你开始所需的一切。