gianarb/gstatus

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

SDK PHP to Github Status API

Fund package maintenance!
gianarb

0.0.1 2014-12-12 23:22 UTC

This package is not auto-updated.

Last update: 2021-03-15 09:16:04 UTC


README

Build Status

Little library to manage Github Status 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!!");
}

With the 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);

Install

composer install gianarb/gstatus

Github Docs

Api Statuses

Change Http Adapter

This lib use Zend\Http see docs Default it use socker adapter but support:

  • Proxy
  • Curl
$zfclient = new \Zend\Http\Client();
$zfclient->setAdapter(new \Zend\Http\Client\Adapter\Curl());
$client = new \Gstatus\Client("token");