pulsestorm/php-github-api

是 KnpLabs/php-github-api 的包装器

安装次数: 10

依赖项: 0

建议者: 0

安全: 0

星星: 0

关注者: 1

分支: 0

公开问题: 2

类型:metapackage

1.0.2 2019-10-19 23:56 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 包含了你开始所需的一切。