roarbb / webhooker
Github Webhook Helper
Requires
- nette/neon: 2.3.*@dev
This package is not auto-updated.
Last update: 2024-04-13 14:02:42 UTC
README
#Installation
The recommended way to install Webhooker is through Composer.
# Install Composer curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version of Webhooker:
composer require roarbb/webhooker
#Prerequisites
Make sure that you have rights to update files on server
chown -R www-data /path/to/website/root
#Webhook config
##Step 1 In website root, create webhook.php file
###basic
<?php use Webhook\Hook; include_once('vendor/autoload.php'); $hook = new Hook(); echo $hook->pull();
###If you want to secure your webhook with secret token (token in file)
webhook.php
<?php use Webhook\Hook; include_once('vendor/autoload.php'); $hook = new Hook(); $hook->setConfigFile(__DIR__ . '/config.neon'); if ($hook->isValidSignature()) { echo $hook->pull(); }
config.neon
github: secret: secretToken123
###If you want to secure your webhook with secret token (token as string)
webhook.php
<?php use Webhook\Hook; include_once('vendor/autoload.php'); $hook = new Hook(); $hook->setGithubSecret('secretToken123'); if ($hook->isValidSignature()) { echo $hook->pull(); }
##Step 2 Login to github, and set up your webhook. Link: https://github.com/[username]/[repository]/settings/hooks
Payload Url: Link to your webhook.php
Content Type: application/json
Secret: secretToken123
Which events would you like to trigger this webhook? - Just the push event.
Active: checked
##Final Step On producion server:
- Double-check permissions
- Don't forget to run
composer update
You can check your automatic updates in Webhooks/Manage Webhook -> Recent Deliveries
#Enjoy your new workflow!