PHP code example of webhooker / webhooker-sdk

1. Go to this page and download the library: Download webhooker/webhooker-sdk 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/ */

    

webhooker / webhooker-sdk example snippets


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

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

$subscriber->id;

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

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

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

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

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