Skip to content

PrestaShop/github-webhook-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

github-webhook-parser

This lib aims to convert Github API v3 events to PHP objects

Install

Via Composer

composer require prestashop/github-webhook-parser

Usage

Use the WebhookHandler class to retrieve the event:

$payload = json_decode($request->getContent(), true);
$webhookHandler = new \PrestaShop\Github\WebhookHandler();

try {
    $event = $webhookHandler->handle($payload);
} catch (\PrestaShop\Github\Exception\EventNotHandledException $e) {
    ...
}

if ($event instanceof \PrestaShop\Github\Event\PullRequestEvent) {
    $action = $event->getAction();
    $pullRequest = $event->getPullRequest();
}

Testing

$ composer install
$ vendor/bin/phpunit

Credits

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages