hostedhooks / hostedhooks-php
HostedHooks API 的 PHP 包
1.0.0
2022-09-17 10:34 UTC
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^6.5 | ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is not auto-updated.
Last update: 2024-09-28 20:45:57 UTC
README
这是一个用于 HostedHooks 的 PHP 包,HostedHooks 是一个 Webhooks 即服务平台
安装
使用包管理器 composer 安装此包。
composer require hostedhooks/hostedhooks-php
工作原理
初始化
使用您的 API 密钥初始化 HostedHooksClient
,API 密钥可以在 此处 找到
use HostedHooks\HostedHooksClient; $hostedHooksClient = new HostedHooksClient('your-api-key');
可用资源
- 应用
- 订阅
- 端点
- Webhook 事件
- 应用消息
- 订阅消息
- 端点消息
应用
use HostedHooks\Resources\App; $app = new App($hostedHooksClient); // get all apps in your HostedHooks account $app->list(); // create a new app in your HostedHooks account $app->store(['name' => 'Awesome App']); //update details of an existing app $app->update($appId, ['name' => 'Updated awesome app name']);
更多关于应用资源的介绍 在此
订阅
use HostedHooks\Resources\Subscription; $subscription = new Subscription($hostedHooksClient); // get all subscriptions for a given app $subscription->list($appId); // create a new subscription for a given app $subscription->store($appId, $payload); //get details for a single subscription $subscription->show($subscriptionId);
更多关于订阅资源的介绍 在此
端点
use HostedHooks\Resources\Endpoint; $endpoint = new Endpoint($hostedHooksClient); //get all endpoints for a given app $endpoint->list($appId); //get detail of a single endpoint for a given app $endpoint->show($appId, $endpointId); //create new endpoint for a given subscription providing array payload $endpoint->store($subscriptionId, $payload); //update an endpoint for a given subscription $endpoint->update($subscriptionId, $endpointId, $payload);
更多关于端点资源的介绍 在此
Webhook 事件
use HostedHooks\Resources\WebhookEvent; $webhookEvent = new WebhookEvent($hostedHooksClient); //list all webhook events for a given app $webhookEvent->list($appId);
更多关于 Webhook 事件资源的介绍 在此
应用消息
use HostedHooks\Resources\AppMessage; $appMessage = new AppMessage($hostedHooksClient); //create a new message for the given app $appMessage->store($appId, $payload);
订阅消息
use HostedHooks\Resources\SubscriptionMessage; $subscriptionMessage = new SubscriptionMessage($hostedHooksClient); //create a new message for the given subscription $subscriptionMessage->store($subscriptionId, $payload);
端点消息
use HostedHooks\Resources\EndpointMessage; $endpointMessage = new EndpointMessage($hostedHooksClient); //create a new message for the given endpoint $endpointMessage->store($endpointId, $payload);
更多关于消息资源的介绍 在此
贡献
欢迎提交拉取请求。对于重大更改,请先提交一个 issue 以讨论您想要进行的更改。
许可证
此包根据 MIT 许可证的条款提供为开源软件。