async-bot / github-status-plugin
GitHub status plugin
Installs: 15
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Language:HTML
Requires
- php: ^7.4
- ext-dom: *
- ext-libxml: *
- amphp/amp: ^2.2.0
- amphp/log: ^1.0
- async-bot/core: dev-master
- room11/dom-utils: ^1.1
Requires (Dev)
- infection/infection: ^0.13.4
- maglnet/composer-require-checker: ^2.0
- phpunit/phpunit: ^8.3
- slevomat/coding-standard: ^5.0.4
- squizlabs/php_codesniffer: ^3.4.2
This package is auto-updated.
Last update: 2024-10-29 06:18:28 UTC
README
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(); } });