zafarjonovich/yii-telegram-error-handler
最新稳定版本:0.1.5
Composer 安装命令:
composer require zafarjonovich/yii-telegram-error-handler
包简介
YiiTelegramErrorHandler
README 文档
README
Installation
Assalomu aleykum. This component is for yii2 framework. You can use this component to send your exceptions to your telegram. It is very easy to use.
If you are creating a web application, you need to put the following code in config/web.php
<?php
$config = [
...
'components' => [
...
'errorHandler' => [
'class' => 'zafarjonovich\YiiTelegramErrorHandler\Web' ,
'telegram' => [
'bot_token' => '123456789:ABCKDFHJKSDHKSJHDFKDHF' ,
'chat_ids' => [123,234,456]
]
]
];
?>
If you are creating a console application, you need to put the following code in config / web.php
<?php
$config = [
...
'components' => [
...
'errorHandler' => [
'class' => 'zafarjonovich\YiiTelegramErrorHandler\Console' ,
'telegram' => [
'bot_token' => '123456789:ABCKDFHJKSDHKSJHDFKDHF' ,
'chat_ids' => [123,234,456]
]
]
];
?>
Set telegram message structure
You can change the structure of messages that go to the telegram. It is very easy to use.There are 4 placements here.
- {message} - exception message
- {file} - exception file
- {line} - exception line
- {code} - exception code
You set up your message structure as follows
<?php
$config = [
...
'components' => [
...
'errorHandler' => [
'class' => 'zafarjonovich\YiiTelegramErrorHandler\Console' ,
'telegram' => [
...
'message_structure' => "File: {file}\n\nLine: {line}"
]
]
];
?>
Typically, the following message structure consists of:
Message:>Message:>Message: {message}\n\nFile: {file}\n\nLine: {line}\n\nCode: {code}
统计信息
- 总下载量: 7.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-05-15