You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Webhook Project facilitates workflow integration of Github Webhook requests. It provides [class wrappers](#wrapper-classes) for existing projects and an optional [end-point installer script](#end-point-installer-script) for a self-contained solution that is easy to deploy.
8
9
9
-
##Requirements
10
+
##Requirements
10
11
* PHP 7.0 or higher
11
12
12
-
##Usage
13
-
###End-point Installer Script
13
+
##Usage
14
+
###End-point Installer Script
14
15
The command-line script [bin/add-endpoint.php](bin/add-endpoint.php) creates a webservice end-point that responds to a Github Webhook for the **PushEvent** on a remote repository by updating a local repository and to a **PingEvent** by displaying a success message.
15
16
16
17
The simplest way to prepare the end-point installer is to copy this project somewhere and run Composer:
@@ -29,7 +30,7 @@ The `--help` switch will provide details on more advanced usage (such as quiet a
29
30
php bin/add-endpoint.php --help
30
31
```
31
32
32
-
###Wrapper Classes
33
+
###Wrapper Classes
33
34
To use this project's wrapper classes within your existing project, the main topics of focus will be the [**Webhook\Request** class](src/Request.php) and **Payload** objects. As a recomended first step, add a dependancy using Composer to your existing project:
At some point in the handling of a Webhook request it is critical that the "Hub Signature" be validated against the shared "Secret" for obvious security reasons. The [end-point installer](#endpoint-installer-script) and [end-point example](#endpoint-installer-script) both accomplish this by using the **Callback::validateRequest()** method of the [**Webhook\Callback** class](src/Callback.php). However, there may be situations where it is more practical to implement validation natively with the [`hash_hmac()` function](http://php.net/manual/en/function.hash-hmac.php) as shown in the example below:
An end-point example is provided at [web/endpoint-example.php](web/endpoint-example.php) which responds to a **PushEvent** by invoking 'pull' or 'update' commands on a local git or svn repository as appropriate. It also responds to a a **PingEvent** with a success message.
121
122
122
123
* copy the provided [web/endpoint-example.php](web/endpoint-example.php)...
0 commit comments