jbelien / github-webhook
Installs: 44
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 2
Open Issues: 1
Type:project
Requires
- php: ^7.2
- symfony/process: 4.1.0
- zendframework/zend-component-installer: 2.1.1
- zendframework/zend-config: 3.2.0
- zendframework/zend-config-aggregator: 1.1.1
- zendframework/zend-diactoros: 1.7.2
- zendframework/zend-expressive: 3.0.2
- zendframework/zend-expressive-fastroute: 3.0.1
- zendframework/zend-expressive-helpers: 5.1.0
- zendframework/zend-servicemanager: 3.3.2
This package is auto-updated.
Last update: 2020-08-27 03:06:17 UTC
README
PHP GitHub Webhook
GitHub Webhook using Zend Expressive (PHP)
Install
composer create-project jbelien/github-webhook
Configuration
Create a config.php
file in config/application
directory :
<?php return [ 'token' => 'your_webhook_token', 'endpoints' => [ [ 'repository' => 'jbelien/myrepo', 'branch' => 'master', // required for PUSH event 'run' => '', ], ], ];
- Replace
your_webhook_token
by the token you provided in your webhook settings (see hereunder) ; - Replace
jbelien/myrepo
by your repository ; - Change the branch name if needed ;
- The
run
option can be one (string) or a list (array) of command to execute ;
You can provide as many endpoints as needed ! For instance, if you need to use this "PHP GitHub Webhook" with more than one repository.
GitHub
- Go in the "Settings" tab of your repository ;
- Go in "Webhooks"
- Create a new webhook
- Put the link to the webhook in "Payload URL" : something like
http://YOUR_IP_ADDRESS/webhook
; don't forget to add the/webhook
after your IP address or domain name ! - Choose
application/json
as "Content type" - I suggest to add a token in "Secret" (don't forget to define it in your
config.php
file) - You only need to send the
push
(orrelease
) events.