fitting/symfony-opsgenie2

此包最新版本(6.0.0)没有提供许可信息。

6.0.0 2024-09-17 22:25 UTC

README

简介

使用symfony opsgenie发送任何错误抛出时的警报消息。

目录

安装

composer require fittinq/symfony-opsgenie

用法

  1. 创建一个Opsgenie类的实例,并为其提供所需的依赖项:HttpClientInterface、OPSGENIE_HOST_URL和OPSGENIE_API_KEY。

     use Fittinq\Symfony\Opsgenie\Opsgenie;
     use Symfony\Contracts\HttpClient\HttpClientInterface;
        
     $httpClient = new HttpClient(); // Replace with your actual HttpClient instance.
     $opsgenie = new Opsgenie($httpClient, OPSGENIE_HOST_URL, OPSGENIE_API_KEY);
    
  2. 您现在可以使用escalate方法向Opsgenie发送警报

     $alertMessage = "This is an alert that needs attention!";
     $opsgenie->escalate($alertMessage);
    

配置

将以下参数添加到您的环境变量中
OPSGENIE_HOST_URL=
OPSGENIE_API_KEY=