Skip to content

Simple PHP library for working with gitlab webhooks

License

Notifications You must be signed in to change notification settings

cavemanlu/gitlab-webhook-lib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitLab Webhook Library

What is this?

Simple library for PHP to work with Gitlab webhooks in a easy and natural way

Usage

Installation

Install using composer: composer require timo-reymann/gitlab-webhook-lib

Documentation

For PHP class documentation please visit timo-reymann.github.io/gitlab-webhook-lib

Use in your scripts

First create a webhook object and pass your secret token

$hook = new \TimoReymann\GitlabWebhookLibrary\Core\Webhook(
  new \TimoReymann\GitlabWebhookLibrary\Token\SecretToken('mySuperSecretToken')
);

To evaluate the header for your secret token and the event. Be aware that this method may throw an exception if the request is not valid!

$hook->parse();

Finally you can work with the result, if you would like to, the "expensive" members are internally cached after you first call them. So you don't have hidden performance bottlenecks. The resulting object is based on the gitlab event type passed via header.

$hook->getResult()

About

Simple PHP library for working with gitlab webhooks

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%