demyan112rv/mountebank-api-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

demyan112rv/mountebank-api-php

最新稳定版本:1.11.1

Composer 安装命令:

composer require demyan112rv/mountebank-api-php

包简介

PHP wrapper for mountebank API

README 文档

README

Latest Stable Version Total Downloads License PHPStan Build Status Coverage Status

What is the Mountebank? See original documentation for understanding.

This package is a php wrapper for mountebank API.

Install

composer require demyan112rv/mountebank-api-php 

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

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

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

use Demyan112rv\MountebankPHP\Stub; $stub = new Stub(); $stub->addResponse($response)->addPredicate($predicate);

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();

统计信息

  • 总下载量: 99.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 21
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 20
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固