2017 © Pedro Peláez
 

library php-github-webhook

Php package for github webhook.

image

tajul/php-github-webhook

Php package for github webhook.

  • Sunday, February 18, 2018
  • by tajul_asri
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Github webhook php

composer install

Sample of usages, (*1)

use Illuminate\Http\Request;

$webhook = (new \WebhookHanlder\GithubWebhook(new Request))
  ->setCredentials(['secret_key' => 'my-secret-key'])
  ->handle()
  ->getResponse();

What is happen behind request during webhook? Lets simulate using fake payload transport via curl on localhost:8080., (*2)

php -S localhost:8080 

Generate mock secret key and payload

php -r "echo hash_hmac('sha1','{"data": "sample_response"}','testing');"

set credentials by using testing in this case.

use Illuminate\Http\Request;

$webhook = (new \WebhookHanlder\GithubWebhook(new Request))
  ->setCredentials(['secret_key' => 'my-secret-key'])
  ->handle()
  ->getResponse();

Get signature validation


$webhook = (new GithubWebhook(new Request)) ->setCredentials(['secret_key' => 'testing']) ->handle() ->passes();

Request via curl by sending fake header and payload.

 curl -X POST localhost:8080 \ 
 -H 'X-Hub-Signature: sha1=40cf35581833746c71a4c3c53886fe2a2e207577' \
 -H 'Content-type: application/json' -d '{"data": "sample_response"}'

The Versions

18/02 2018

dev-master

9999999-dev

Php package for github webhook.

  Sources   Download

MIT

The Requires

 

by Tajul

25/08 2017

v0.1.1

0.1.1.0

Php package for github webhook.

  Sources   Download

MIT

The Requires

 

by Tajul

03/08 2017

v0.1

0.1.0.0

Php package for github webhook.

  Sources   Download

MIT

The Requires

 

by Tajul