Skip to content

async-bot/github-status-plugin

Repository files navigation

GitHub Status

Latest Stable Version Build Status Coverage Status License

This plugin emit an event when the uptime status of GitHub services change.

Requirements

  • PHP 7.4

Installation

composer require async-bot/github-status-plugin

Usage

Initialization

$plugin = new Plugin(
    \AsyncBot\Logger\Factory::buildConsoleLogger(),
    new \AsyncBot\Plugin\Retreiever\Http(new \Amp\Http\Client\Client(), new \AsyncBot\Plugin\GitHubStatus\Parser\Html()),
    new \AsyncBot\Plugin\GitHubStatus\Storage\InMemoryStorage(),
);

Attaching an event listener

If the GitHub status changes an event will be emitted which can be subscribed to. The registered event listener will get an \AsyncBot\Plugin\GitHubStatus\Event\Data\Status object passed which contains information about the status change.

$plugin->onStatusChange(new class implement \AsyncBot\Plugin\GitHubStatus\Event\Listener\StatusChange {
    /**
     * @return Promise<null>
     */
    public function __invoke(Status $status): Promise
    {
        var_dump($status);

        return new Success();
    }
});

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published