hostedhooks / hostedhooks-php
PHP package for HostedHooks API
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: 2025-05-25 00:17:12 UTC
README
A PHP package for HostedHooks, a Webhooks as a Service Platform
Installation
Use the package manager composer to install the package.
composer require hostedhooks/hostedhooks-php
How it works
Initialization
Initialize the HostedHooksClient
with your API key that is found here
use HostedHooks\HostedHooksClient; $hostedHooksClient = new HostedHooksClient('your-api-key');
Resources available
- App
- Subscription
- Endpoint
- Webhook Event
- AppMessage
- SubscriptionMessage
- EndpointMessage
App
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']);
Read more about App resource here
Subscription
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);
Read more about Subscription resource here
Endpoint
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);
Read more about Endpoint resource here
WebhookEvent
use HostedHooks\Resources\WebhookEvent; $webhookEvent = new WebhookEvent($hostedHooksClient); //list all webhook events for a given app $webhookEvent->list($appId);
Read more about WebhookEvent resource here
AppMessage
use HostedHooks\Resources\AppMessage; $appMessage = new AppMessage($hostedHooksClient); //create a new message for the given app $appMessage->store($appId, $payload);
SubscriptionMessage
use HostedHooks\Resources\SubscriptionMessage; $subscriptionMessage = new SubscriptionMessage($hostedHooksClient); //create a new message for the given subscription $subscriptionMessage->store($subscriptionId, $payload);
EndpointMessage
use HostedHooks\Resources\EndpointMessage; $endpointMessage = new EndpointMessage($hostedHooksClient); //create a new message for the given endpoint $endpointMessage->store($endpointId, $payload);
Read more about Message resources here
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
This package is available as open source under the terms of the MIT License.