PHP code example of prestashop / github-webhook-parser

1. Go to this page and download the library: Download prestashop/github-webhook-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

prestashop / github-webhook-parser example snippets


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