pruno / github-webhooks
Utility to handle multiple Github web-hooks on the same platform
Requires
- php: >=5.3.3
- zendframework/zend-eventmanager: 2.2.*
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-10-26 16:10:25 UTC
README
Github Webhooks Library (with events support).
Introduction
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
Requirements
- php >=5.3.3
Optionally:
- git (to use the Pull event listener)
Installation
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
Quick implementation (Pull on Push event)
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.
Embedding
Refer to library/GithubWebhooks/Server.php
as an example implementation.
Contribute
Please do. Fork it and send pull requests.
License
This software is released under the New-BSD License.