PHPackages                             loilo/github-webhook-handler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. loilo/github-webhook-handler

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

loilo/github-webhook-handler
============================

Validate and utilize GitHub webhooks

1.0.1(5y ago)0198MITPHPPHP ^7.2CI failing

Since Apr 19Pushed 5y ago1 watchersCompare

[ Source](https://github.com/loilo/github-webhook-handler)[ Packagist](https://packagist.org/packages/loilo/github-webhook-handler)[ RSS](/packages/loilo-github-webhook-handler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

 [![Hook](hook.svg)](hook.svg)

GitHub Webhook Handler
======================

[](#github-webhook-handler)

[![Tests](https://camo.githubusercontent.com/51144781d94c282b3161df4b229d8a382fb2b94a3f95cb5e0a9972707d7f0ac9/68747470733a2f2f62616467656e2e6e65742f6769746875622f636865636b732f6c6f696c6f2f6769746875622d776562686f6f6b2d68616e646c65722f6d6173746572)](https://github.com/loilo/github-webhook-handler/actions)[![Packagist](https://camo.githubusercontent.com/b9730c2a67a73f5cc83e694dd842dfc84a62e9682f985bb84d691a2c6e155c85/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f6c6f696c6f2f6769746875622d776562686f6f6b2d68616e646c6572)](https://packagist.org/packages/loilo/github-webhook-handler)

Handle GitHub webhooks with PHP.

Installation
------------

[](#installation)

```
composer require loilo/github-webhook-handler
```

Usage
-----

[](#usage)

Start by creating a handler:

```
$handler = new Loilo\GithubWebhook\Handler($secret);
```

`$secret` is the webhook secret defined in the GitHub backend. It *can* be omitted, however providing it is *strongly recommended* to prevent abuse of the endpoint.

To handle a request (specifically, a [PSR-7 `ServerRequestInterface`](https://www.php-fig.org/psr/psr-7/#321-psrhttpmessageserverrequestinterface)), pass that request to the `handle` method:

```
$delivery = $handler->handle($request);
```

If the webhook request is invalid, [a failure-specific exception](src/Exceptions) will be thrown. Otherwise, the method returns a [`Delivery`](src/Delivery.php) object which provides access to the event that caused the hook request and to the payload data that was sent along with it:

```
// Get the triggered event (e.g. 'push')
$delivery->event();

// Get the whole webhook payload as an associative array
$delivery->payload();

// Get a nested path in the payload (returns `null` if the path doesn't exist)
$delivery->payload('repository.full_name');
```

### Single-File Endpoint

[](#single-file-endpoint)

There may be very simple cases where you're not using a PHP framework for your script and just want to put a single PHP file endpoint out there. To avoid having to deal with exceptions and creating appropriate error responses, you may use the `respond()` method:

```
$delivery = $handler->respond($request);
```

Now you can safely use the `$delivery` object without any further worries — if validation of the webhook request fails, the handler will set an appropriate HTTP status code, print the error message and [stop script execution](https://php.net/manual/en/function.exit.php).

> **Pro Tip:** Not having a PSR-7 request object at hand? Install the [`guzzlehttp/psr7`](https://github.com/guzzle/psr7) package and use `\GuzzleHttp\Psr7\ServerRequest::fromGlobals()` to create a request object from the environment.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~50 days

Total

2

Last Release

2170d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1da49bad9203cc40a34d975dc00c80af09452bee1da6413e2f1b8214b539675?d=identicon)[loilo](/maintainers/loilo)

---

Top Contributors

[![loilo](https://avatars.githubusercontent.com/u/1922624?v=4)](https://github.com/loilo "loilo (7 commits)")

---

Tags

githubwebhook

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/loilo-github-webhook-handler/health.svg)

```
[![Health](https://phpackages.com/badges/loilo-github-webhook-handler/health.svg)](https://phpackages.com/packages/loilo-github-webhook-handler)
```

###  Alternatives

[google/cloud-core

Google Cloud PHP shared dependency, providing functionality useful to all components.

343121.4M79](/packages/google-cloud-core)[aimeos/aimeos-base

Aimeos base layer for abstracting from host environments

2.1k134.0k1](/packages/aimeos-aimeos-base)[phpgt/dom

Modern DOM API.

12412.2M18](/packages/phpgt-dom)[anthropic-ai/sdk

Anthropic PHP SDK

129134.7k5](/packages/anthropic-ai-sdk)[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

73142.3k25](/packages/jaxon-php-jaxon-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
