tao-test/app/vendor/jtl-software/opsgenie-client
2022-08-29 20:14:13 +02:00
..
contrib Code, before instalation. 2022-08-29 20:14:13 +02:00
docker Code, before instalation. 2022-08-29 20:14:13 +02:00
examples Code, before instalation. 2022-08-29 20:14:13 +02:00
public Code, before instalation. 2022-08-29 20:14:13 +02:00
src Code, before instalation. 2022-08-29 20:14:13 +02:00
tests Code, before instalation. 2022-08-29 20:14:13 +02:00
.gitignore Code, before instalation. 2022-08-29 20:14:13 +02:00
.php_cs.dist Code, before instalation. 2022-08-29 20:14:13 +02:00
.phpunit.result.cache Code, before instalation. 2022-08-29 20:14:13 +02:00
.travis-ci Code, before instalation. 2022-08-29 20:14:13 +02:00
.travis.yml Code, before instalation. 2022-08-29 20:14:13 +02:00
composer Code, before instalation. 2022-08-29 20:14:13 +02:00
composer.json Code, before instalation. 2022-08-29 20:14:13 +02:00
composer.lock Code, before instalation. 2022-08-29 20:14:13 +02:00
docker-compose.yml Code, before instalation. 2022-08-29 20:14:13 +02:00
php-cs-fixer Code, before instalation. 2022-08-29 20:14:13 +02:00
phpunit.xml Code, before instalation. 2022-08-29 20:14:13 +02:00
README.md Code, before instalation. 2022-08-29 20:14:13 +02:00

JTL - PHP API Client for OpsGenie

Build Status

PHP implementation to connect to OpsGenie Alert API. The implementation is focused on what we require @JTL for our application Alerting.

https://docs.opsgenie.com/docs/alert-api

Features

  • Create Alert
  • Get specific Alert (by alias) from API
  • Close Alert
  • Ping Heatbeat

How-To-Use

Create / Get / Close Alert

# named constructor to create a client (for EU)
$client = AlertApiClient::createForEUApi(getenv(UPSGENIE_TOKEN));

$alert = new Alert('eazyauction', 'test-alert', 'foo mag bär', 'beer-bar');
$response = $client->createAlert($alert);

if($response->isSuccessful()){
  
    // read our former created alert
    $alert = $client->getAlert(new GetAlertRequest($alert->getAlias()));

    // close our former created alert
    $client->closeAlert(new CloseAlertRequest($alert->getAlias()));
}

Ping Heartbeat

$token = "xxx-xxx-xxx";
$client = new HeartbeatApiClient(HttpClient::createForEUApi(getenv(UPSGENIE_TOKEN)));
do {
    $result = $client->sendPing(new PingRequest('beat'));
    var_dump($result, $result->isSuccessful());
    sleep(60);
} while(true);