1. Go to this page and download the library: Download juststeveking/webhooks 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/ */
juststeveking / webhooks example snippets
use JustSteveKing\Webhooks\Webhook;
class YourWebhook extends Webhook
{
public function headers(): array
{
$signature = hash_hmac(
algo: 'sha256',
data: \Safe\json_encode(
value: $this->buildPayload(),
flags: JSON_THROW_ON_ERROR,
),
key: 'Your signing key goes here',
);
return [
'Content-Type' => 'application/json',
'Signature' => $signature,
];
}
public function buildPayload(): array
{
return [
'foo' => 'bar',
];
}
public function url(): string
{
return 'Your URL goes here.';
}
public function method(): Method
{
return Method::POST;
}
public function plugins(): array
{
return [];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.