PHPackages                             linio/behat-web-api-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. linio/behat-web-api-extension

ActiveBehat-extension[Testing &amp; Quality](/categories/testing)

linio/behat-web-api-extension
=============================

Maintained fork of behat/web-api-extension with extensions and support.

3.1.0(2y ago)5179.3k↓25.4%7BSD-3-ClausePHPPHP &gt;=7.3 || ^8.0

Since May 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/LinioIT/behat-web-api-extension)[ Packagist](https://packagist.org/packages/linio/behat-web-api-extension)[ RSS](/packages/linio-behat-web-api-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (6)Versions (13)Used By (0)

WebApiExtension
===============

[](#webapiextension)

[![Latest Stable Version](https://camo.githubusercontent.com/4c724866b0ad04914b56f3b131f13a314cf9b36cecbd24b5b574fda9c0afc752/68747470733a2f2f706f7365722e707567782e6f72672f6c696e696f2f62656861742d7765622d6170692d657874656e73696f6e2f762f737461626c652e737667)](https://packagist.org/packages/linio/behat-web-api-extension)[![License](https://camo.githubusercontent.com/4f74c31a82bdede26de3bd5736a6f7a496dbd5a57c95c3b933a7c209f5158eb5/68747470733a2f2f706f7365722e707567782e6f72672f6c696e696f2f62656861742d7765622d6170692d657874656e73696f6e2f6c6963656e73652e737667)](https://packagist.org/packages/linio/behat-web-api-extension)[![Build Status](https://github.com/LinioIT/behat-web-api-extension/actions/workflows/build.yml/badge.svg)](https://github.com/LinioIT/behat-web-api-extension/actions/workflows/build.yml/badge.svg)

Provides testing for REST APIs with Behat 3. This is a maintained fork of `behat/web-api-extension` with additional features and long term support.

Usage
-----

[](#usage)

Just add to your composer development dependencies:

```
$ composer require --dev linio/behat-web-api-extension

```

And activate your extension:

```
# behat.yml
default:
  # ...
  extensions:
    Behat\WebApiExtension: ~

```

Private to protected
--------------------

[](#private-to-protected)

One of the tricky things in the original `behat/web-api-extension` library is the extensive use of `private` properties and methods, preventing you from easily extending it. This fork fixes it by moving everything to `protected`.

Placeholder support
-------------------

[](#placeholder-support)

One of the new features from this fork is the ability to use placeholders with regular expressions to help you test input or output that varies. For example:

```
  Scenario: Sending values with placeholders
    Given a file named "features/send_values.feature" with:
      """
      Feature: Exercise WebApiContext data sending
        In order to validate the send request step
        As a context developer
        I need to be able to send a request with values in a scenario

        Scenario:
          When I send a POST request to "echo" with values:
          | name | name |
          | pass | pass |
          Then the response should contain "POST"
          And the response should contain json:
          '''
          {
          "name" : "name",
          "pass": "%[a-z]+%"
          }
          '''
      """
    When I run "behat features/send_values.feature"
    Then it should pass with:
      """
      ...

      1 scenario (1 passed)
      """

```

It is common for APIs to return responses with dynamic content. UUIDs, timestamps, generated passwords, etc. All of those, unfortunately, make writing scenarios a bit challenging. With placeholders, you can easily test by using regular expressions to ensure they are returned in a valid format, but can still be variable.

Other examples of placeholders:

```
{
  "timestamp": "%^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{2,}[\\-\\+][0-9]{2}:[0-9]{2}$%",
  "uuid": "%^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$%"
}

```

Tests
-----

[](#tests)

```
$ composer install
$ php -S 0.0.0.0:8080 -t testapp &
$ vendor/bin/behat -f progress

```

Copyright
---------

[](#copyright)

Copyright (c) 2014 Konstantin Kudryashov (ever.zet). See LICENSE for details.

Contributors
------------

[](#contributors)

- Christophe Coevoet [stof](http://github.com/stof) \[lead developer\]
- Other [awesome developers](https://github.com/Behat/WebApiExtension/graphs/contributors)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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

Recently: every ~447 days

Total

12

Last Release

985d ago

Major Versions

1.2.3 → 2.0.02017-03-13

2.0.2 → 3.0.02022-06-22

PHP version history (2 changes)1.0.0PHP &gt;=5.4

3.0.0PHP &gt;=7.3 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (22 commits)")[![fernandocarletti](https://avatars.githubusercontent.com/u/416930?v=4)](https://github.com/fernandocarletti "fernandocarletti (10 commits)")[![klaussilveira](https://avatars.githubusercontent.com/u/467729?v=4)](https://github.com/klaussilveira "klaussilveira (10 commits)")[![Rocko10](https://avatars.githubusercontent.com/u/4745682?v=4)](https://github.com/Rocko10 "Rocko10 (8 commits)")[![fgm](https://avatars.githubusercontent.com/u/143311?v=4)](https://github.com/fgm "fgm (6 commits)")[![felipegirotti](https://avatars.githubusercontent.com/u/1295097?v=4)](https://github.com/felipegirotti "felipegirotti (5 commits)")[![Swop](https://avatars.githubusercontent.com/u/545340?v=4)](https://github.com/Swop "Swop (3 commits)")[![damian-af](https://avatars.githubusercontent.com/u/9433699?v=4)](https://github.com/damian-af "damian-af (2 commits)")[![ifdattic](https://avatars.githubusercontent.com/u/966877?v=4)](https://github.com/ifdattic "ifdattic (1 commits)")[![dantleech](https://avatars.githubusercontent.com/u/530801?v=4)](https://github.com/dantleech "dantleech (1 commits)")[![camcima](https://avatars.githubusercontent.com/u/1918601?v=4)](https://github.com/camcima "camcima (1 commits)")[![bycosta](https://avatars.githubusercontent.com/u/724830?v=4)](https://github.com/bycosta "bycosta (1 commits)")[![abacaphiliac](https://avatars.githubusercontent.com/u/1656273?v=4)](https://github.com/abacaphiliac "abacaphiliac (1 commits)")[![MiguelTzab](https://avatars.githubusercontent.com/u/7762644?v=4)](https://github.com/MiguelTzab "MiguelTzab (1 commits)")

---

Tags

behatbehat-extensionapitestBehat

### Embed Badge

![Health badge](/badges/linio-behat-web-api-extension/health.svg)

```
[![Health](https://phpackages.com/badges/linio-behat-web-api-extension/health.svg)](https://phpackages.com/packages/linio-behat-web-api-extension)
```

###  Alternatives

[imbo/behat-api-extension

API extension for Behat

1082.5M9](/packages/imbo-behat-api-extension)[leanphp/behat-code-coverage

Generate Code Coverage reports for Behat tests

50359.8k2](/packages/leanphp-behat-code-coverage)[kielabokkie/jsonapi-behat-extension

Behat extension for testing JSON APIs

1516.5k](/packages/kielabokkie-jsonapi-behat-extension)[ubirak/rest-api-behat-extension

Rest Api Extension for Behat

41327.0k2](/packages/ubirak-rest-api-behat-extension)[polishsymfonycommunity/symfony2-mocker-extension

Behat extension for mocking services defined in the Symfony2 dependency injection container.

26253.1k4](/packages/polishsymfonycommunity-symfony2-mocker-extension)[teaandcode/behat-guzzle-extension

Behat API extension using Guzzle Service Descriptions to functionally test API endpoints

1017.7k](/packages/teaandcode-behat-guzzle-extension)

PHPackages © 2026

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