Skip to content

PHP library to handle Webhooks from various services.

License

Notifications You must be signed in to change notification settings

noplanman/service-webhook-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimum PHP Version Latest Stable Version Total Downloads License

PHP library to handle Webhooks from various services.

Installation

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

Usage

Very basic functionality provided so far for:

GitHub

Docs - GitHubHandler.php

use NPM\ServiceWebhookHandler\Handlers\GitHubHandler;

$handler = new GitHubHandler('webhook_secret');
if ($handler->validate()) {
    // All good, use the received data!
    $data = $handler->getData();
}

Travis CI

Docs - TravisCIHandler.php

use NPM\ServiceWebhookHandler\Handlers\TravisCIHandler;

$handler = new TravisCIHandler();
if ($handler->validate()) {
    // All good, use the received data!
    $data = $handler->getData();
}

Telegram Login

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();
}