PHP code example of hostedhooks / hostedhooks-php

1. Go to this page and download the library: Download hostedhooks/hostedhooks-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hostedhooks / hostedhooks-php example snippets


use HostedHooks\HostedHooksClient;

$hostedHooksClient = new HostedHooksClient('your-api-key');

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);

use HostedHooks\Resources\WebhookEvent;

$webhookEvent = new WebhookEvent($hostedHooksClient);

//list all webhook events for a given app
$webhookEvent->list($appId);

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);
bash
composer