PHPackages                             rikta/test-webhook - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. rikta/test-webhook

ActiveLibrary[Testing &amp; Quality](/categories/testing)

rikta/test-webhook
==================

Very basic implementation of a temporary webhook for integration testing

016PHP

Since Sep 19Pushed 4y ago1 watchersCompare

[ Source](https://github.com/RiktaD/test-webhook)[ Packagist](https://packagist.org/packages/rikta/test-webhook)[ RSS](/packages/rikta-test-webhook/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

TestWebhook
===========

[](#testwebhook)

A very basic implementation of a temporary webhook for integration testing.

Useful if you need an incoming webhook during testing which is called from other applications.

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

[](#installation)

`composer require --dev rikta/test-webhook`

Usage
-----

[](#usage)

### Initialisation

[](#initialisation)

Simply create an instance of `WebhookServer` and keep the reference alive. This will provide a webhook-server at a random port.

You can get the url to the webhook of this server-instance with `$server->getUrl()`You have to provide the external hostname/ip of this machine if your calling application is outside your machine/container

### Querying Data

[](#querying-data)

The `$server->query()` provides a fresh query-object that provides a simple way to query for data.

You can use `$server->query()->get()` to get all currently stored requests as PSR-7 ServerRequestInterface-objects

#### get()

[](#get)

`$query->get()` will

- get all currently stored requests,
- apply provided sorting
- apply provided filters
- return an array of PSR-7 ServerRequestInterface-objects

example: `$lastTwoRequests = $server->query()->last(2)->get()`

### count()

[](#count)

`$query->count()` will return the amount of matching requests.

### first($n)/last($n)

[](#firstnlastn)

`$query->first($n)` &amp; `$query->last($n)` will reduce the result to the first/last $n requests.

If no `$n` is provided it will reduce it to a single request.

example: `$lastTwoRequests = $server->query()->last(2)->get()`

### sort(?callable $sortFunction = null)

[](#sortcallable-sortfunction--null)

`$query->sort(?callable $sortFunction = null)` will sort the results with the provided comparator-function (on `ServerRequestInterface`)

If no `$sortFunction` is provided it will sort in chronological order.

example: `$requestChronic = $server->query()->sort()->get()`

### filter(callable $callable)

[](#filtercallable-callable)

`$query->filter($callable)` allows to provide a `$callable` to an array\_filter around the results.

example:

```
$query = $server
      ->query()
      ->filter(fn (ServerRequestInterface $r) => $request->getBody()->getContents() === 'Hello World!');
self::assertEquals(2, $query->count());
```

### delete()

[](#delete)

`$query->delete()` will delete all matching requests.

example: `$server->query()->last(2)->delete()`

### waitForMatchingRequests(int $amount = 1, $maxSeconds = 10)

[](#waitformatchingrequestsint-amount--1-maxseconds--10)

`$query->waitForMatchingRequests` will wait until $amount matching requests have arrived. Or throw an LoopTimeoutException after $maxSeconds.

example: `$request = $server->query()->waitForMatchingRequests()->get()[0]`

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![MadWillow](https://avatars.githubusercontent.com/u/16151453?v=4)](https://github.com/MadWillow "MadWillow (13 commits)")

### Embed Badge

![Health badge](/badges/rikta-test-webhook/health.svg)

```
[![Health](https://phpackages.com/badges/rikta-test-webhook/health.svg)](https://phpackages.com/packages/rikta-test-webhook)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14429.2M359](/packages/dms-phpunit-arraysubset-asserts)[phpbenchmark/phpbenchmark

Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses

8011.5k2](/packages/phpbenchmark-phpbenchmark)

PHPackages © 2026

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