PHP code example of kayw-geek / yii2-error-dingtalk

1. Go to this page and download the library: Download kayw-geek/yii2-error-dingtalk 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/ */

    

kayw-geek / yii2-error-dingtalk example snippets


   'errorHandler' => [
               'errorAction' => 'site/error',
           	],
   

public function actions()
	{
            return [
                'error' => [
                    'class' => 'kaywGeek\yii2ErrorDingtalk\ErrorDingtalk', 
                    'handle' => [ '500','403','401','502','404'], //启用哪些状态码
                    'title' => 'PC Web 异常状态码监测通知', //通知标题
                    'logCategoryName' => 'error-status', //日志分类名
                    'dingTalkWebHookUrl' => 'https://oapi.dingtalk.com/robot/send?access_token=xxxxxx', //钉钉群机器人获取到的webhook URL
                    'enable' => true, //是否启用
                    'text'=>'- 用户IP: '.Yii::$app->request->userIP, //设置额外的通知内容

                ],
            ];
	}