定制 webhooker/webhooker-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webhooker/webhooker-sdk

最新稳定版本:0.4.0

Composer 安装命令:

composer require webhooker/webhooker-sdk

包简介

SDK for communicating with the WebHooker.io API

README 文档

README

Latest Version on Packagist Software License Build Status Total Downloads

Interact with the WebHooker.io API

Install

Via Composer

composer require webhooker/webhooker-sdk

You must also have Guzzle installed. By default, the package is only compatible with Guzzle 6:

composer require guzzlehttp/guzzle

Usage

Instantiate:

$webhooker = Webhooker\Webhooker::usingGuzzle('YOUR-API-KEY');

Add a subscriber:

$subscriber = $webhooker->addSubscriber('Their Name Here');

$subscriber->id;

Add an endpoint for the subscriber to receive messages:

// you can use "jsonSubscription" or "xmlSubscription"
$subscription = $webhooker->subscriber($id)->jsonSubscription($tenantKey, $deliveryUrl, $secret)->save();
$subscription = $webhooker->subscriber($id)->xmlSubscription($tenantKey, $deliveryUrl, $secret)->save();

// additional options for a subscription, e.g. Basic Auth, or "Legacy Payloads"
$subscription = $webhooker->subscriber($id)
  ->jsonSubscription($tenantKey, $deliveryUrl, $secret)
  ->basicAuth($username, $password)
  ->legacyPayload('p_reply')
  ->save();

$subscription->id;

Send a JSON message:

// $jsonData can be something JSON-able (array/object) or a pre-encoded JSON string
$webhooker->notify('account-1', 'something.happened')->json($jsonData)->send();

Or, because JSON is very common, just pass it directly to the send() method:

$webhooker->notify('account-1', 'something.happened')->send($jsonData);

Send an XML message:

// $xmlData must be an XML string
$webhooker->notify('account-1', 'something.happened')->xml($xmlData)->send();

Send both XML and JSON messages:

$webhooker->notify('account-1', 'something.happened')->xml($xmlData)->json($jsonData)->send();

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email dan@radweb.co.uk instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1.69k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-20