rainerch / yii2-eventhook
此包的最新版本(1.2.2)没有提供许可证信息。
将 yii2 事件转发到不同的目标
1.2.2
2021-03-24 06:52 UTC
Requires
- php: >=7.0
- bluerhinos/phpmqtt: ^1.0
- yiisoft/yii2: ~2.0
This package is auto-updated.
Last update: 2024-09-24 14:16:24 UTC
README
将 yii2 事件转发到不同的目标(Web、MQTT...)
如何使用
在您的 config.php 中
<?php
$config = [
'bootstrap' = ['webhook'],
'components' = [
'webhook' => [
'class' => 'rainerch\eventhook\HttpPost',
'events' => [
[['\yii\db\ActiveRecord'], ['afterInsert', 'afterUpdate'], [
'url' => 'https://example.com/myAwesomeWebhook'
]],
['app\MyModel', 'afterInsert', [
'url' => 'https://example.com/MyAwesomeModelWebhook'
]],
function($sender) {
// use closure as filter, return true if you want to send the webhook
}
]
],
]
]