PHPackages                             demyan112rv/mountebank-api-php - 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. demyan112rv/mountebank-api-php

ActiveLibrary[API Development](/categories/api)

demyan112rv/mountebank-api-php
==============================

PHP wrapper for mountebank API

1.13.1(2mo ago)21102.2k↓23.9%2MITPHPPHP &gt;=8.0 &lt;8.5CI passing

Since Jan 26Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/demyan112rv/mountebank-api-php)[ Packagist](https://packagist.org/packages/demyan112rv/mountebank-api-php)[ RSS](/packages/demyan112rv-mountebank-api-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (45)Used By (0)

Mountebank API PHP
==================

[](#mountebank-api-php)

[![Latest Stable Version](https://camo.githubusercontent.com/84b772fa06ec6cd8f3fe2699d0899cfe6dc5d35bc88b346b2de873a594362d24/68747470733a2f2f706f7365722e707567782e6f72672f64656d79616e31313272762f6d6f756e746562616e6b2d6170692d7068702f762f737461626c65)](https://packagist.org/packages/demyan112rv/mountebank-api-php)[![Total Downloads](https://camo.githubusercontent.com/84ffb395e8f4008e065e745145a5a2e0d630daf2e490cd1c277abbe7e1ae97d6/68747470733a2f2f706f7365722e707567782e6f72672f64656d79616e31313272762f6d6f756e746562616e6b2d6170692d7068702f646f776e6c6f616473)](https://packagist.org/packages/demyan112rv/mountebank-api-php)[![License](https://camo.githubusercontent.com/1946268536bf7290ec3ddc1096fd3460df42771dc8c10994835d31df417ca7bf/68747470733a2f2f706f7365722e707567782e6f72672f64656d79616e31313272762f6d6f756e746562616e6b2d6170692d7068702f6c6963656e7365)](https://packagist.org/packages/demyan112rv/mountebank-api-php)[![PHPStan](https://camo.githubusercontent.com/8200e616fde4404cb348e95bb987c65291059e5f89521837e88fc4436073298c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d627269676874677265656e2e737667)](https://github.com/phpstan/phpstan)[![Build Status](https://camo.githubusercontent.com/efafc14f6b7f87175adfd4725905e7fa93c11760c1b483da2ea6348b878710e7/68747470733a2f2f6170692e7472617669732d63692e636f6d2f64656d79616e31313272762f6d6f756e746562616e6b2d6170692d7068702e7376673f6272616e63683d6d6173746572267374617475733d706173736564)](https://api.travis-ci.com/demyan112rv/mountebank-api-php.svg?branch=master&status=passed)[![Coverage Status](https://camo.githubusercontent.com/612d680355e91395ed0cab46522f0bd72ace52fb8537e6295f6ad66366259fe9/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f64656d79616e31313272762f6d6f756e746562616e6b2d6170692d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/demyan112rv/mountebank-api-php?branch=master)

What is the Mountebank? See original [documentation](https://www.mbtest.dev/) for understanding.

This package is a php wrapper for [mountebank API](https://www.mbtest.dev/docs/api/overview).

Install
-------

[](#install)

```
composer require demyan112rv/mountebank-api-php

```

Tests
-----

[](#tests)

Before run tests install dependencies, build Docker images and run containers:

```
composer install
docker-compose up

```

Enter the container php container and run tests:

```
docker exec -it mountebank_php bash
cd /var/www/mountebank-api-php
php vendor/bin/phpunit

```

Usage basics
------------

[](#usage-basics)

### Response for stub

[](#response-for-stub)

```
use Demyan112rv\MountebankPHP\Response;
use Demyan112rv\MountebankPHP\Response\Behavior;

$response = new Response(Response::TYPE_IS);
$response->setConfig([
    'statusCode' => 200,
    'headers' => ['Content-Type' => 'application/json'],
    'body' => ['foo' => 'bar']
])->addBehavior(
    (new Behavior(Behavior::TYPE_WAIT))
        ->setConfig((new Behavior\Config\Wait())->setValue(500))
);
```

### Predicate for stub

[](#predicate-for-stub)

```
use Demyan112rv\MountebankPHP\Predicate;
use Demyan112rv\MountebankPHP\Predicate\XPath;
use Demyan112rv\MountebankPHP\Predicate\JsonPath;

$predicate = new Predicate(Predicate::OPERATOR_EQUALS);
$predicate->setConfig(['path' => '/test'])
    ->setXPath((new XPath())->setSelector('selector')->setNs(['foo' => 'bar']))
    ->setJsonPath((new JsonPath('selector')));
```

### Stub for imposter

[](#stub-for-imposter)

```
use Demyan112rv\MountebankPHP\Stub;

$stub = new Stub();
$stub->addResponse($response)->addPredicate($predicate);
```

### Imposter for Mountebank

[](#imposter-for-mountebank)

```
use Demyan112rv\MountebankPHP\Imposter;
use Demyan112rv\MountebankPHP\Mountebank;

$imposter = new Imposter('Test imposter', 1234, Imposter::PROTOCOL_HTTP);
$imposter->addStub($stub);

// Mountbank config client
$mb = new Mountebank(new \GuzzleHttp\Client(), 'http://localhost', 2525);

// Add new imposter
$response = $mb->addImposter($imposter);

// remove all imposters
$response = $mb->removeImposters();
```

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance86

Actively maintained with recent releases

Popularity40

Moderate usage in the ecosystem

Community13

Small or concentrated contributor base

Maturity93

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 93.5% 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 ~69 days

Recently: every ~149 days

Total

44

Last Release

69d ago

Major Versions

0.9.2 → 1.0.02019-04-15

PHP version history (9 changes)0.2.2PHP &gt;=7.1

0.6PHP &gt;=7.1 &lt;8.0

1.1.0PHP &gt;=7.3 &lt;8.1

1.3.0PHP &gt;=7.3 &lt;=8.1

1.3.1PHP &gt;=7.3 &lt;8.2

1.4.0PHP &gt;=7.4 &lt;8.3

1.10.0PHP &gt;=7.4 &lt;8.4

1.12.0PHP &gt;=7.4 &lt;8.5

1.13.0PHP &gt;=8.0 &lt;8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/79fcf238632cd69873d9abdf2546a1190601b71adb8506ccf8d07b35c2ffcbd3?d=identicon)[demyan112rv](/maintainers/demyan112rv)

---

Top Contributors

[![demyan112rv](https://avatars.githubusercontent.com/u/6883337?v=4)](https://github.com/demyan112rv "demyan112rv (58 commits)")[![mikewolfxyou](https://avatars.githubusercontent.com/u/349693?v=4)](https://github.com/mikewolfxyou "mikewolfxyou (3 commits)")[![vinhlh](https://avatars.githubusercontent.com/u/261283?v=4)](https://github.com/vinhlh "vinhlh (1 commits)")

---

Tags

mockmockingmountebankmountebank-api

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/demyan112rv-mountebank-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/demyan112rv-mountebank-api-php/health.svg)](https://phpackages.com/packages/demyan112rv-mountebank-api-php)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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