upmind / webhook-endpoint
Library to simplify server implementations for receiving webhooks from Upmind
Requires
- psr/http-message: ^1.0|^2.0
Requires (Dev)
- nyholm/psr7: ^1.8
- phpunit/phpunit: ^9.0
README
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.