Github Webhooks Library (with events support).
This library aims to provide:
-
A simple and embeddable event-based library
-
A handy stand-alone server class
-
An event listener to perform
git pull
- Support multiple deploy key
- NOTE: Linux only
- php >=5.3.3
Optionally:
- git (to use the Pull event listener)
Using composer:
Add the following to your composer.json
file:
"require": {
"pruno/github-webhooks": "2.0.*",
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/pruno/github-webhooks.git"
}
]
Alternately with git submodules:
git submodule add https://github.com/pruno/github-webhooks.git pruno/github-webhooks
1 - Create a Github Webhook:
- Set an arbitrary URL path (this will be your hook id)
(e.g: https://example.com/POSTRECEIVE)
- Both payload versions are supported.
- The push event is enough.
1 - Copy sample/composer.json
to your project root directory.
2 - Run composer install
.
3 - Copy sample/index.php
to your public directory.
4 - Edir sample/index.php
with:
- hook information (line 9).
- git working copy information (line 14).
5 - You may remove line 12 once finished.
Notice:
Remember that the user who is running your webserver (or fast-cgi process) need to have write permissions on your git working copy.
Refer to library/GithubWebhooks/Server.php
as an example implementation.
Please do. Fork it and send pull requests.
This software is released under the New-BSD License.