PHPackages                             dvlpm/codeception-wiremock-extension - 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. dvlpm/codeception-wiremock-extension

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

dvlpm/codeception-wiremock-extension
====================================

Wiremock extension for Codeception

0.1.0(3y ago)09.5k↓23.7%GPL-3.0+PHPPHP &gt;=7.4

Since Mar 16Pushed 3y agoCompare

[ Source](https://github.com/dvlpm/codeception-wiremock-extension)[ Packagist](https://packagist.org/packages/dvlpm/codeception-wiremock-extension)[ RSS](/packages/dvlpm-codeception-wiremock-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (9)Versions (4)Used By (0)

codeception-wiremock-extension
==============================

[](#codeception-wiremock-extension)

This Codeception Extension allows developers and testers to use WireMock to mock external services when running codeception tests.

codeception-wiremock-extension connects to an already running instance of WireMock or can also run automatically a local standalone one. And, it is able to download the version of wiremock you preffer and run it too. After the tests are finished it will close the connection and turn wiremock service off (when it started it).

See also
--------

[](#see-also)

- [WireMock PHP library](https://github.com/rowanhill/wiremock-php)
- [Stubbing using WireMock](http://wiremock.org/stubbing.html)
- [Verifying using WireMock](http://wiremock.org/verifying.html)

Note
----

[](#note)

If you need an application with a functionality that is similar to the one offered by WireMock and is 100% PHP, please give Phiremock a try: [Phiremock](https://github.com/mcustiel/phiremock), it also has a nice [codeception extension](https://github.com/mcustiel/phiremock-codeception-extension).

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

[](#installation)

### Composer:

[](#composer)

This project is published in packagist, so you just need to add it as a dependency in your composer.json:

```
$ composer require lamoda/codeception-wiremock-extension
```

Configuration Examples
----------------------

[](#configuration-examples)

### Module

[](#module)

The module allow you to connect to a WireMock instance, it can be the one ran by the extension or an already running one.

```
# acceptance.suite.yml
modules:
    enabled:
        - WireMock:
            host: my.wiremock.host # defaults to 127.0.0.1
            port: 80 # defaults to 8080
```

### Extension

[](#extension)

#### Default configuration

[](#default-configuration)

This configuration will download WireMock version 1.57 and run it on port 8080, writing logs to codeception tests \_output dir.

```
# codeception.yml
extensions:
    enabled:
        - Codeception\Extension\WireMock
```

#### Connect to a running WireMock instance

[](#connect-to-a-running-wiremock-instance)

```
# codeception.yml
extensions:
    enabled:
        - Codeception\Extension\WireMock
    config:
        Codeception\Extension\WireMock:
            host: my.wiremock.server
            port: 8080
```

#### Start a local WireMock instance and run it with given command line arguments

[](#start-a-local-wiremock-instance-and-run-it-with-given-command-line-arguments)

```
# codeception.yml
extensions:
    enabled:
        - Codeception\Extension\WireMock
    config:
        Codeception\Extension\WireMock:
            jar-path: /opt/wiremock/bin/wiremock-standalone.jar
            port: 18080
            https-port: 18443
            verbose: true
            root-dir: /opt/wiremock/root

```

#### Download a WireMock instance and run it with given command line arguments

[](#download-a-wiremock-instance-and-run-it-with-given-command-line-arguments)

```
# codeception.yml
extensions:
    enabled:
        - Codeception\Extension\WireMock
    config:
        Codeception\Extension\WireMock:
            download-version: 1.57
            port: 18080
            https-port: 18443
            verbose: true
            root-dir: /opt/wiremock/root
            logs-path: /var/log/wiremock
```

How to use
----------

[](#how-to-use)

### Prepare your application

[](#prepare-your-application)

First of all, configure your application so when it is being tested it will replace its external services with WireMock. For instance, if you make some requests to a REST service located under , replace that url in configuration with the url where WireMock runs, for instance: [http://localhost:8080/rest\_interface](http://localhost:8080/rest_interface).

### Write your tests

[](#write-your-tests)

```
// YourCest.php
class YourCest extends \Codeception\TestCase\Test
{
    public function _after(\AcceptanceTester $I)
    {
        $I->cleanAllPreviousRequestsToWireMock();
    }

    // tests
    public function tryToTest(\AcceptanceTester $I)
    {
        $I->expectRequestToWireMock(
            WireMock::get(WireMock::urlEqualTo('/some/url'))
                ->willReturn(WireMock::aResponse()
                ->withHeader('Content-Type', 'text/plain')
                ->withBody('Hello world!'))
        );
        // Here you should execute your application in a way it requests wiremock. I do this directly to show it.
        $response = file_get_contents('http://localhost:18080/some/url');

        $I->assertEquals('Hello world!', $response);
        $I->receivedRequestInWireMock(
            WireMock::getRequestedFor(WireMock::urlEqualTo('/some/url'))
        );
    }

    // Also, you can access wiremock-php library directly
    public function moreComplexTest()
    {
        $wiremockPhp = Codeception\Extension\WiremockConnection::get();
        // Now you can use wiremock-php library
    }
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 58.1% 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

Unknown

Total

1

Last Release

1160d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a17bdfc81ed6e857648617e643fae27e9b5afa35d8fde16b924bc04c0c10ed6e?d=identicon)[anton.ehunov](/maintainers/anton.ehunov)

---

Top Contributors

[![mcustiel](https://avatars.githubusercontent.com/u/3268370?v=4)](https://github.com/mcustiel "mcustiel (18 commits)")[![Phrlog](https://avatars.githubusercontent.com/u/9060150?v=4)](https://github.com/Phrlog "Phrlog (5 commits)")[![dedpikhto](https://avatars.githubusercontent.com/u/3489952?v=4)](https://github.com/dedpikhto "dedpikhto (2 commits)")[![lacoder-png](https://avatars.githubusercontent.com/u/192860877?v=4)](https://github.com/lacoder-png "lacoder-png (1 commits)")[![HaiD84](https://avatars.githubusercontent.com/u/2562280?v=4)](https://github.com/HaiD84 "HaiD84 (1 commits)")[![omnilight](https://avatars.githubusercontent.com/u/3306537?v=4)](https://github.com/omnilight "omnilight (1 commits)")[![ehunov](https://avatars.githubusercontent.com/u/9989115?v=4)](https://github.com/ehunov "ehunov (1 commits)")[![slr42](https://avatars.githubusercontent.com/u/4040908?v=4)](https://github.com/slr42 "slr42 (1 commits)")[![Vabogco](https://avatars.githubusercontent.com/u/51154232?v=4)](https://github.com/Vabogco "Vabogco (1 commits)")

---

Tags

codeceptionmockextensionmodulewiremockmock external services

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dvlpm-codeception-wiremock-extension/health.svg)

```
[![Health](https://phpackages.com/badges/dvlpm-codeception-wiremock-extension/health.svg)](https://phpackages.com/packages/dvlpm-codeception-wiremock-extension)
```

###  Alternatives

[mcustiel/codeception-http-mock

Extension for HTTP Mock.

1424.3k1](/packages/mcustiel-codeception-http-mock)[mcustiel/phiremock-codeception-extension

Codeception extension for Phiremock. Allows to stub remote services for HTTP requests.

311.0M5](/packages/mcustiel-phiremock-codeception-extension)[site5/phantoman

The Codeception extension for automatically starting and stopping PhantomJS when running tests.

481.1M17](/packages/site5-phantoman)[docler-labs/codeception-slim-module

Codeception Module for Slim framework.

13178.0k1](/packages/docler-labs-codeception-slim-module)

PHPackages © 2026

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