upmind/webhook-endpoint

Library to simplify server implementations for receiving webhooks from Upmind

v1.2 2023-08-10 15:14 UTC

This package is auto-updated.

Last update: 2024-05-10 16:49:05 UTC


README

Latest Version on Packagist GitHub Tests Action Status

Refer to the Upmind Webhooks guide to discover how to configure your first webhook endpoint.

Installation

composer require upmind/webhook-endpoint

Requirements

  • PHP (7.4, 8.0, 8.1, 8.2)
  • Composer

Usage

The Examples directory contains sample code for how to use this library to implement your endpoint and consume Upmind webhooks.

Quick-start

The following example shows how to consume and authenticate webhooks using plain PHP:

webhook-endpoint/examples/vanilla-endpoint.php

Lines 3 to 13 in 3cfdae2

$endpointSecret = 'xxxxxxxxxx';
$factory = new \Upmind\Webhooks\WebhookFactory($endpointSecret);
try {
// get the webhook instance and authenticate it
$webhook = $factory->create();
$webhook->assertValidAuth();
} catch (\Upmind\Webhooks\Exceptions\WebhookException $e) {
http_response_code($e->getHttpCode());
exit($e->getMessage());
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

GNU General Public License version 3 (GPLv3). Please see License File for more information.

Upmind

Sell, manage and support web hosting, domain names, ssl certificates, website builders and more with Upmind.com.