prestashop / github-webhook-parser
Converts Github API v3 events to PHP objects
Installs: 1 122
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 10
Forks: 1
Open Issues: 1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-12-06 18:36:13 UTC
README
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.