This lib aims to convert Github API v3 events to PHP objects
Via Composer
composer require prestashop/github-webhook-parser
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();
}
$ composer install
$ vendor/bin/phpunit
The MIT License (MIT). Please see License File for more information.