PHP code example of loilo / github-webhook-handler

1. Go to this page and download the library: Download loilo/github-webhook-handler 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/ */

    

loilo / github-webhook-handler example snippets


$handler = new Loilo\GithubWebhook\Handler($secret);

$delivery = $handler->handle($request);

// Get the triggered event (e.g. 'push')
$delivery->event();

// Get the whole webhook payload as an associative array
$delivery->payload();

// Get a nested path in the payload (returns `null` if the path doesn't exist)
$delivery->payload('repository.full_name');

$delivery = $handler->respond($request);