PHP code example of yian / fwalert-sdk

1. Go to this page and download the library: Download yian/fwalert-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yian / fwalert-sdk example snippets




use FwAlert\FwAlert;

$fw = new FwAlert;
$fw->SendAlert(
    '这里替换成在饭碗警告后台拿到的 webhook url',
    [
        'hello' => 'world',
    ]
);



use FwAlert\FwAlert;

$fw = new FwAlert;

// 提前注册好“频道”
$fw->AddChannel("ch1", "webhook_url1");
$fw->AddChannel("ch2", "webhook_url2");
// ...

$fw->Send(
    "ch1", // 后续只需要使用频道别名就可以发送到指定的告警规则了
    [
        'hello' => 'world',
    ]
);