PHPackages                             bentools/psr7-request-matcher - 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. [API Development](/categories/api)
4. /
5. bentools/psr7-request-matcher

ActiveLibrary[API Development](/categories/api)

bentools/psr7-request-matcher
=============================

A PSR-7 RequestMatcher interface for use into several projects.

1.1(8y ago)1309.4k—4.4%4MITPHPPHP &gt;=5.3

Since Jul 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/bpolaszek/psr7-request-matcher)[ Packagist](https://packagist.org/packages/bentools/psr7-request-matcher)[ RSS](/packages/bentools-psr7-request-matcher/feed)WikiDiscussions master Synced 1mo ago

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

[![Latest Stable Version](https://camo.githubusercontent.com/a26da2ace762ac141ef8e4bb652b86b8a4c3589af21d4d6f24ddb9ae7c4c4d78/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f707372372d726571756573742d6d6174636865722f762f737461626c65)](https://packagist.org/packages/bentools/psr7-request-matcher)[![License](https://camo.githubusercontent.com/4cf62970d0c3d6991b959e5f59b32ff5abbd127f11fc63f2654b9a344ddaea45/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f707372372d726571756573742d6d6174636865722f6c6963656e7365)](https://packagist.org/packages/bentools/psr7-request-matcher)[![Build Status](https://camo.githubusercontent.com/daa138692edb1288c80c7fa947266efc8f4b535f5caa949d9eff8a43efcc1218/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f62706f6c61737a656b2f707372372d726571756573742d6d6174636865722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/bpolaszek/psr7-request-matcher)[![Total Downloads](https://camo.githubusercontent.com/4b8a87337af3e2b09724c1159aba5ac65a5ebad9e0f23a87ee1ed10650d59124/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f707372372d726571756573742d6d6174636865722f646f776e6c6f616473)](https://packagist.org/packages/bentools/psr7-request-matcher)

PSR-7 Request Matcher
=====================

[](#psr-7-request-matcher)

This library is just composed of interfaces to implement, to check wether or not a request and/or a response match some arbitrary conditions.

These interfaces provide no return type-hint and is therefore compatible from **PHP 5.3+**.

Examples
--------

[](#examples)

### Request matcher

[](#request-matcher)

```
namespace App;

use BenTools\Psr7\RequestMatcherInterface;
use Psr\Http\Message\RequestInterface;

class ExampleOrgRequestMatcher implements RequestMatcherInterface
{
    /**
     * @inheritdoc
     */
    public function matchRequest(RequestInterface $request)
    {
        return 'www.example.org' === $request->getUri()->getHost();
    }

}
```

### Response matcher

[](#response-matcher)

```
namespace App;

use BenTools\Psr7\ResponseMatcherInterface;
use Psr\Http\Message\ResponseInterface;

class TeapotResponseMatcher implements ResponseMatcherInterface
{
    /**
     * @inheritdoc
     */
    public function matchResponse(ResponseInterface $response)
    {
        return 418 === $response->getStatusCode();
    }

}
```

### Transfer matcher

[](#transfer-matcher)

```
namespace App;

use BenTools\Psr7\TransferMatcherInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

class DummyTransferMatcher implements TransferMatcherInterface
{
    /**
     * @inheritdoc
     */
    public function matchTransfer(RequestInterface $request, ResponseInterface $response)
    {
        return $request->hasHeader('Authorization')
            && 'Welcome, human.' === (string) $response->getBody();
    }

}
```

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

[](#installation)

> composer require bentools/psr7-request-matcher

Tests
-----

[](#tests)

> ./vendor/bin/phpunit

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

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 ~237 days

Total

2

Last Release

2994d ago

### Community

Maintainers

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

---

Top Contributors

[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (6 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bentools-psr7-request-matcher/health.svg)

```
[![Health](https://phpackages.com/badges/bentools-psr7-request-matcher/health.svg)](https://phpackages.com/packages/bentools-psr7-request-matcher)
```

###  Alternatives

[algolia/algoliasearch-client-php

API powering the features of Algolia.

69433.0M114](/packages/algolia-algoliasearch-client-php)[swisnl/json-api-client

A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.

211473.2k12](/packages/swisnl-json-api-client)[php-heroku-client/php-heroku-client

A PHP client for the Heroku Platform API

24404.8k4](/packages/php-heroku-client-php-heroku-client)[yoti/yoti-php-sdk

Yoti SDK for quickly integrating your PHP backend with Yoti

27539.9k1](/packages/yoti-yoti-php-sdk)[trycourier/courier

Courier PHP SDK

16643.9k](/packages/trycourier-courier)[commercetools/commercetools-sdk

The official PHP SDK for the commercetools Composable Commerce APIs

19281.5k](/packages/commercetools-commercetools-sdk)

PHPackages © 2026

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