PHP code example of hivehook / sdk

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

    

hivehook / sdk example snippets




use Hivehook\HivehookClient;

$client = new HivehookClient(
    baseUrl: 'http://localhost:8080',
    apiKey: getenv('HIVEHOOK_API_KEY'),
);

$source = $client->sources->create([
    'name' => 'Stripe production',
    'slug' => 'stripe-prod',
    'providerType' => 'stripe',
    'verifyConfig' => ['secret' => 'whsec_...'],
]);

printf("created source %s. POST webhooks to /ingest/%s\n", $source['id'], $source['slug']);

use Hivehook\Webhook;

$signature = $_SERVER['HTTP_X_HIVEHOOK_SIGNATURE'];
$timestamp = (int) $_SERVER['HTTP_X_HIVEHOOK_TIMESTAMP'];
$ok = Webhook::verify($body, 'your-signing-secret', $signature, $timestamp, 300);