2017 © Pedro Peláez
 

library stack-github-webhook

Stack middleware which will verify if the incoming GitHub web hook request is correctly signed.

image

swop/stack-github-webhook

Stack middleware which will verify if the incoming GitHub web hook request is correctly signed.

  • Tuesday, November 22, 2016
  • by Swop
  • Repository
  • 1 Watchers
  • 7 Stars
  • 996 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Github WebHook Stack middleware

Build
Status, (*1)

Stack middleware to restrict application access to GitHub Event bot with signed payload., (*2)

Every incoming request will see its X-Hub-Signature header checked in order to validate that the request was originally performed by GitHub. Any requests which doesn't have correct signature will lead to a 401 Unauthorized JSON response., (*3)

Installation

The recommended way to install this library is through Composer:, (*4)

composer require "swop/github-webhook-stackphp"

Usage

Silex example

require __DIR__ . '/../vendor/autoload.php';

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);

Symfony example

# web/app_dev.php

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

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
Debug::enable();

require_once __DIR__.'/../app/AppKernel.php';

$kernel = new AppKernel('dev', true);
$kernel->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);

Contributing

See CONTRIBUTING file., (*5)

Original Credits

License

This library is released under the MIT license. See the complete license in the bundled LICENSE file., (*6)

The Versions

22/11 2016

dev-master

9999999-dev

Stack middleware which will verify if the incoming GitHub web hook request is correctly signed.

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware stack security github webhook stack middleware

11/11 2016

1.1.x-dev

1.1.9999999.9999999-dev

Stack middleware to restrict application access to GitHub Event bot with signed payload

  Sources   Download

MIT

The Requires

 

The Development Requires

stack github webhook stack middleware

11/11 2016

v1.1

1.1.0.0

Stack middleware to restrict application access to GitHub Event bot with signed payload

  Sources   Download

MIT

The Requires

 

The Development Requires

stack github webhook stack middleware

29/10 2014

1.0.x-dev

1.0.9999999.9999999-dev

Stack middleware to restrict application access to GitHub Event bot with signed payload

  Sources   Download

MIT

The Requires

 

The Development Requires

stack github webhook stack middleware

29/10 2014

v1.0

1.0.0.0

Stack middleware to restrict application access to GitHub Event bot with signed payload

  Sources   Download

MIT

The Requires

 

The Development Requires

stack github webhook stack middleware