gianarb / gstatus
该软件包已被 弃用 且不再维护。未建议替代软件包。
SDK PHP 用于 Github 状态 API
0.0.1
2014-12-12 23:22 UTC
Requires
Requires (Dev)
- phpspec/phpspec: ~2.0
- phpunit/phpunit: ~4
This package is not auto-updated.
Last update: 2021-03-15 09:16:04 UTC
README
一个小型库,用于管理 Github 状态 API
<?php use Gstatus\Client; use Gstatus\Request\Status; use Zend\Http\Client as HttpClient; require 'vendor/autoload.php'; $status = new Status("gianarb", "gstatus"); $status->setStatusFor("1ab5f09eb4e736890b17b7abdb80ed3e368a478f", [ "state" => "failure", "target_url" => "http://gianarb.it", "description" => "D'oh!", "context" => "my/test", ]); $client = new Client($token); $client->setHttpClient(new HttpClient()); $response = $client->send($status); if ($response->getStatusCode() != 200) { throw new \RuntimeException("D'oh!!"); }
使用 DiC
<?php $status = new Status("gianarb", "gstatus"); $status->setStatusFor("1ab5f09eb4e736890b17b7abdb80ed3e368a478f", [ "state" => "failure", "target_url" => "http://gianarb.it", "description" => "D'oh!", "context" => "my/test", ]); $client = $container->get("github.client"); $client->send($status);
安装
composer install gianarb/gstatus
Github 文档
更改 Http 适配器
此库使用 Zend\Http,请参阅文档。默认情况下,它使用 socker 适配器,但支持
- 代理
- Curl
$zfclient = new \Zend\Http\Client(); $zfclient->setAdapter(new \Zend\Http\Client\Adapter\Curl()); $client = new \Gstatus\Client("token");