nhalstead/webhook-coordinator

此包已被弃用且不再维护。作者建议使用 nhalstead/php-facilitator 包。

触发 Webhooks 将数据发布到 php 中的通道。这将与 Slack、Discord 和其他使用 WebHooks 的系统兼容。

v1.0 2018-08-29 04:43 UTC

This package is auto-updated.

Last update: 2020-10-04 20:43:18 UTC


README

使用基础包,您可以轻松地将请求发布到拥有 WebHook 终端的服务,如 Slack、Discord 等!

这是一个 PHP 包,因此它遵循 PSR4 标准,可以使用或无需 composer。

依赖,除了 CURL 外。

系统甚至已经准备好让您添加自己的自定义 Webhook 终端。

支持的服务

名称 完全支持
自定义事件
Slack nhalstead\Endpoints\SlackWebhook
Discord nhalstead\Endpoints\DiscordWebhook
IFTTT nhalstead\Endpoints\IFTTTWebhook

安装

您可以通过 composer 安装此包

composer require nhalstead/php-facilitator

或者您可以从 GitHub 克隆代码

git clone https://github.com/nhalstead/php-facilitator.git

如何使用

使用 Composer 加载包

```php
>require_once("../vendor/autoload.php"); // Composer Method, Loading by PSR4
>use nhalstead\Facilitator\Facilitator;
>```

这将向指定事件上的特定通道发送负载。

use nhalstead\Facilitator\Facilitator;
use nhalstead\Facilitator\Endpoints\DiscordWebhook;

// Create new Queue
$queue = new Facilitator();

// Make new Event
$newEvent = new DiscordWebhook("[DISCORD WEBHOOK URL]");
$newEvent->username("John");
$newEvent->avatar("https://png.icons8.com/clouds/50/000000/megaphone.png");
$newEvent->message("Hello");


// Add and Send Events in Queue
$queue->addEvent($newEvent);
$queue->sendEvents();

更多示例请参阅 /examples 文件夹。

贡献者