PHP code example of swop / github-webhook-stackphp

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

    

swop / github-webhook-stackphp example snippets




use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

$app = new \Silex\Application();

$app->get('/', function(Request $request) {
    return new Response('Hello world!', 200);
});

$app = (new \Stack\Builder())
    ->push('Swop\GitHubWebHookStackPHP\GitHubWebHook', 'my_secret')
    ->resolve($app)
;

$request = Request::createFromGlobals();
$response = $app->handle($request)->send();

$app->terminate($request, $response);

# web/app_dev.php

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;

$loader = ->loadClassCache();

$stack = (new Stack\Builder())
    ->push('Swop\GitHubWebHookStackPHP\GitHubWebHook', 'my_secret')
;

$kernel = $stack->resolve($kernel);

Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);