This plugin emit an event when the uptime status of GitHub services change.
- PHP 7.4
composer require async-bot/github-status-plugin
$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(),
);
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();
}
});