divineomega/github-status-api

Programmatically determine if GitHub is working well, or experiencing issues

v1.0.0 2018-12-07 23:11 UTC

This package is auto-updated.

Last update: 2024-03-17 09:51:12 UTC


README

Build Status

⚠️ Warning: As of 11th December 2018, GitHub have deprecated the status page that this package parses, so current status information may not be up-to-date. More information: https://blog.github.com/2018-12-11-introducing-the-new-github-status-site/

This package provides a way to programmatically determine if GitHub is working well, or experiencing issues. Both the current status and historical statuses can be looked up by date.

49678157-77f06f00-fa7a-11e8-857c-0586751a3540.png

68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646976696e656f6d6567612f6769746875622d7374617475732d6170692e737667

Installation

To install PHP GitHub Status API, just run the following composer command.

composer require divineomega/github-status-api

Remember to include the vendor/autoload.php file if your framework does not do this for you.

Usage

To check the state of GitHub currently, simply create a new Client object, and call its status method. You can optionally pass a Carbon date object to the status method to retrieve a historical status.

use Carbon\Carbon;
use DivineOmega\GitHubStatusApi\Client;
use DivineOmega\GitHubStatusApi\Enums\GitHubStatus;

require_once 'vendor/autoload.php';

$status    = (new Client())->status();
// $status = (new Client())->status(Carbon::parse('2018-12-06 17:00'));

switch ($status) {
    case GitHubStatus::GOOD:
        echo 'GitHub is up! No issues reported.';
        break;

    case GitHubStatus::MINOR:
        echo 'GitHub is experiencing minor issues.';
        break;

    case GitHubStatus::MAJOR:
        echo 'GitHub is experiencing major issues.';
        break;

    case GitHubStatus::UNKNOWN:
        echo 'Unable to determine GitHub\'s status.';
        break;
}

echo PHP_EOL;