PHPackages                             jasonbenett/codeception-module-wiremock - 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. jasonbenett/codeception-module-wiremock

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

jasonbenett/codeception-module-wiremock
=======================================

A Codeception module for WireMock integration.

2.0.1(5mo ago)01MITPHPPHP ^8.2CI passing

Since Nov 28Pushed 5mo agoCompare

[ Source](https://github.com/JasonBenett/codeception-module-wiremock)[ Packagist](https://packagist.org/packages/jasonbenett/codeception-module-wiremock)[ RSS](/packages/jasonbenett-codeception-module-wiremock/feed)WikiDiscussions main Synced 1mo ago

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

Codeception Module WireMock
===========================

[](#codeception-module-wiremock)

[![CI](https://github.com/jasonbenett/codeception-module-wiremock/actions/workflows/ci.yml/badge.svg)](https://github.com/jasonbenett/codeception-module-wiremock/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/aad0328e669e5d352ee945c1d8bd4800cfc4ef51cabf07cba3685dcec3e328b7/68747470733a2f2f636f6465636f762e696f2f67682f6a61736f6e62656e6574742f636f646563657074696f6e2d6d6f64756c652d776972656d6f636b2f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/jasonbenett/codeception-module-wiremock)[![PHPStan Level](https://camo.githubusercontent.com/b6d441ad4fe8332cb16c72aa27f22cc685181dfd74ae34964afc92c6c1146b3c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c2532306d61782d627269676874677265656e2e737667)](https://phpstan.org/)[![PHP Version](https://camo.githubusercontent.com/d840cef9807c8f76051ad687841d67f4d830c84e0d83236968e53124ef6742d5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d3838393242462e737667)](https://www.php.net/)[![Codeception](https://camo.githubusercontent.com/d9b3dfbb0fdab3bfdb500ae6e38fabb25c253df1c36ddbf63fcdba062fa5bbd8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f646563657074696f6e2d253345253344352e332d677265656e2e737667)](https://codeception.com/)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

A Codeception module for WireMock integration, allowing you to mock HTTP services in your functional tests.

Features
--------

[](#features)

- Create HTTP stubs for any HTTP method (GET, POST, PUT, DELETE, etc.)
- Verify that expected HTTP requests were made
- Advanced request matching (body patterns, headers, query parameters)
- Retrieve request data for debugging
- Automatic cleanup between tests
- Near-miss analysis for debugging failed verifications
- Follows Codeception naming conventions

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Codeception 5.3 or higher
- A PSR-18 HTTP Client implementation (e.g., Guzzle, Symfony HttpClient)
- A PSR-17 HTTP Factory implementation (e.g., guzzlehttp/psr7)
- A running WireMock server

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

[](#installation)

Install via Composer:

```
composer require jasonbenett/codeception-module-wiremock
```

This module depends on PSR-18 (HTTP Client) and PSR-17 (HTTP Factories) interfaces. You'll need to install a compatible implementation:

**Using Guzzle (recommended):**

```
composer require guzzlehttp/guzzle
```

**Using Symfony HttpClient:**

```
composer require symfony/http-client nyholm/psr7
```

**Other PSR-18/PSR-17 implementations work as well.**

Architecture
------------

[](#architecture)

This module follows **PSR-18** (HTTP Client) and **PSR-17** (HTTP Factories) standards, providing true dependency inversion:

- **No hard dependency on Guzzle** - Use any PSR-compliant HTTP client
- **Framework agnostic** - Works with Symfony HttpClient, Guzzle, or custom clients
- **Optional auto-discovery** - Automatically creates Guzzle instances if available
- **Full control** - Inject your own configured PSR clients for advanced scenarios

This approach allows you to:

- Choose your preferred HTTP client library
- Control HTTP client configuration (timeouts, SSL, proxies, etc.)
- Test with mock PSR-18 clients
- Upgrade HTTP client versions independently

Quick Start
-----------

[](#quick-start)

### 1. Start WireMock Server

[](#1-start-wiremock-server)

Using Docker (recommended):

```
docker run -d -p 8080:8080 wiremock/wiremock:latest
```

### 2. Configure Codeception

[](#2-configure-codeception)

Add the WireMock module to your `codeception.yml` or suite configuration:

```
modules:
  enabled:
    - \JasonBenett\CodeceptionModuleWiremock\Module\Wiremock:
        host: localhost
        port: 8080
```

### 3. Write Your First Test

[](#3-write-your-first-test)

```
