ctv/php-webhook-sdk

SDK,轻松管理ClickToValid Webhooks。

dev-master 2017-02-27 12:07 UTC

This package is not auto-updated.

Last update: 2024-09-29 03:15:24 UTC


README

管理来自https://clicktovalid.com/的webhooks的SDK

如何使用

<?php
// load dependencies
// ...

// Get webhook data
$data    = file_get_contents("php://input");
$webhook = ClickToValid\Manager::parseData($data);

// do what you want
// for example you want to send a mail
// when a new request is sent :
if ($webhook instanceof ClickToValid\Webhook\RequestSentWebhook) {
    $to      = 'johndoe@mycompany.com';
    $title   = 'A new ClickToValid request was sent';
    $message = 'Hi John, the request "'.$webhook->getRequest()->getName().'" was sent at '.$webhook->getDate()->format('Y-m-d H:i:s').' by "'.$webhook->getRequest()->getSender()->getFullname().'".';
    mail($to, $title, $message);
}

类型

我们邀请您打开webhook类以查看属性并执行您想要的操作。