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

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

ivashkevitch/codeception-wiremock-extension
===========================================

Wiremock extension for Codeception

v1.1.0(7y ago)162[1 issues](https://github.com/ivashkevitch/codeception-wiremock-extension/issues)[1 PRs](https://github.com/ivashkevitch/codeception-wiremock-extension/pulls)GPL-3.0+PHPPHP &gt;=5.6

Since Oct 31Pushed 5y ago1 watchersCompare

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

READMEChangelogDependencies (9)Versions (5)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:

```
    "require": {
        // ...
        "mcustiel/codeception-wiremock-extension": "*"
    }
```

If you want to access directly to this repo, adding this to your composer.json should be enough:

```
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/mcustiel/codeception-wiremock-extension"
        }
    ],
    "require": {
        "mcustiel/codeception-wiremock-extension": "dev-master"
    }
}
```

Or just download the release and include it in your path.

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

22

↓

LowBetter than 22% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

4

Last Release

2730d ago

Major Versions

v0.5 → v1.0.02016-03-16

PHP version history (2 changes)v0.5PHP &gt;=5.4

v1.1.0PHP &gt;=5.6

### Community

Maintainers

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

---

Top Contributors

[![mcustiel](https://avatars.githubusercontent.com/u/3268370?v=4)](https://github.com/mcustiel "mcustiel (18 commits)")

---

Tags

codeceptionmockextensionmodulewiremockmock external services

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/ivashkevitch-codeception-wiremock-extension/health.svg)](https://phpackages.com/packages/ivashkevitch-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)
