PHP library to handle Webhooks from various services.
Installation is pretty straightforward:
Require this package with Composer
Either run this command in your command line:
composer require noplanman/service-webhook-handler
or
For existing Composer projects, edit your project's composer.json
file to require noplanman/service-webhook-handler
:
"require": {
"noplanman/service-webhook-handler": "^0.2"
}
and then run composer update
Very basic functionality provided so far for:
use NPM\ServiceWebhookHandler\Handlers\GitHubHandler;
$handler = new GitHubHandler('webhook_secret');
if ($handler->validate()) {
// All good, use the received data!
$data = $handler->getData();
}
use NPM\ServiceWebhookHandler\Handlers\TravisCIHandler;
$handler = new TravisCIHandler();
if ($handler->validate()) {
// All good, use the received data!
$data = $handler->getData();
}
Docs - TelegramLoginHandler.php
use NPM\ServiceWebhookHandler\Handlers\TelegramLoginHandler;
$handler = new TelegramLoginHandler('123:BOT_API_KEY');
if ($handler->validate(json_encode($_GET))) {
// All good, use the received data!
$data = $handler->getData();
}