PHPackages                             twentytwo-labs/behat-open-api - 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. [API Development](/categories/api)
4. /
5. twentytwo-labs/behat-open-api

ActiveLibrary[API Development](/categories/api)

twentytwo-labs/behat-open-api
=============================

Behat contexts

1.1.0(1mo ago)343.9k↑235.7%PHPPHP &gt;=8.1CI failing

Since Jun 10Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/TwentytwoLabs/behat-open-api)[ Packagist](https://packagist.org/packages/twentytwo-labs/behat-open-api)[ RSS](/packages/twentytwo-labs-behat-open-api/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (7)Dependencies (30)Versions (9)Used By (0)

Behatch contexts
================

[](#behatch-contexts)

Behat Open Api contexts provide most common Api Behat tests.

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

[](#installation)

This extension requires:

- Behat 3+
- Mink extension

### Project dependency

[](#project-dependency)

1. [Install Composer](https://getcomposer.org/download/)
2. Require the package with Composer:

```
$ composer require --dev twentytwo-labs/behat-open-api

```

3. Activate extension by specifying its class in your `behat.yml`:

```
# behat.yml
default:
    # ...
    extensions:
       TwentytwoLabs\BehatOpenApiExtension:
          schemaFile: "file:///path/to/your/schema" #optinal
```

Usage
-----

[](#usage)

In `behat.yml`, enable desired contexts:

```
default:
    suites:
        default:
            contexts:
                - TwentytwoLabs\BehatOpenApiExtension\Context\DebugContext: ~
                - TwentytwoLabs\BehatOpenApiExtension\Context\RestContext: ~
                - TwentytwoLabs\BehatOpenApiExtension\Context\JsonContext: ~
                - TwentytwoLabs\BehatOpenApiExtension\Context\OpenApiContext: ~
```

### Examples

[](#examples)

- `TwentytwoLabs\BehatOpenApiExtension\Context\DebugContext`

    - `@Then print last response headers`
    - `@Then print profiler link`
- `TwentytwoLabs\BehatOpenApiExtension\Context\JsonContext`

    - `@Then the response should be in JSON`
    - `@Then the response should not be in JSON`
    - `@Then the JSON node :node should be equal to :text`
    - `@Then the JSON nodes should be equal to:`
    - `@Then the JSON node :node should match :pattern`
    - `@Then the JSON node :node should be null`
    - `@Then the JSON node :node should not be null`
    - `@Then the JSON node :node should be true`
    - `@Then the JSON node :node should be false`
    - `@Then the JSON node :node should be equal to the string :text`
    - `@Then the JSON node :node should be equal to the number :number`
    - `@Then the JSON node :node should have :count element(s)`
    - `@Then the JSON node :node should contain :text`
    - `@Then the JSON node :node should not contain :text`
    - ```
        @Then the JSON nodes should contain:
          | ... |

        ```
    - ```
          @Then the JSON nodes should not contain:
            | ... |

        ```
    - `@Then the JSON node :name should exist`
    - `@Then the JSON node :name should not exist`
    - `@Then the JSON should be equal to:`
    - ```
          @Then I should see JSON with key :
            | ... |

        ```
    - ```
          @Then the JSON should be match to:
            | ... |

        ```

        This step link to \[Array-comparator\]( package)
- `TwentytwoLabs\BehatOpenApiExtension\Context\OpenApiContext`

    - `@Then the response should be valid according to the operation id :operationId`
- `TwentytwoLabs\BehatOpenApiExtension\Context\RestContext`

    - `@Then I add :name header equal to :value`
    - `@Given I send a :method request to :path`
    - ```
            @Given I send a :method request to :path with parameters:
              | key | value |
              | ... | ..... |

        ```
    - ```
         @Given I send a :method request to :path with body:
         """
         {
          #...
         }
         """

        ```
    - `@Then /^the response status code should be equal to (?P\d+)$/`
    - ```
         @Then the response should be equal to:
         """
          {
            # ...
          }
         """

        ```
    - `@Then the response should be empty`
    - `@Then the header :name should be equal to :value`
    - `@Then the header :name should not be equal to :value`
    - `@Then the header :name should contain :value`
    - `@Then the header :name should not contain :value`
    - `@Then the header :name should not exist`
    - `@Then the header :name should match :regex`
    - `@Then the header :name should not match :regex`
    - `@Then the response should expire in the future`
    - `@Then the response should be encoded in :encoding`

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance90

Actively maintained with recent releases

Popularity34

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

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

Recently: every ~336 days

Total

8

Last Release

47d ago

PHP version history (3 changes)1.0.0PHP &gt;=7.4

1.0.3PHP &gt;=8.0

1.0.5PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e755df79c9237f59677baef80e49defca9c8a7988c149e5024fa0ccc063c365?d=identicon)[ThibautAlgrin](/maintainers/ThibautAlgrin)

---

Top Contributors

[![thibaut-algrin](https://avatars.githubusercontent.com/u/2413615?v=4)](https://github.com/thibaut-algrin "thibaut-algrin (9 commits)")

---

Tags

symfonyswaggeropenapiBehat

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/twentytwo-labs-behat-open-api/health.svg)

```
[![Health](https://phpackages.com/badges/twentytwo-labs-behat-open-api/health.svg)](https://phpackages.com/packages/twentytwo-labs-behat-open-api)
```

###  Alternatives

[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k50.1M306](/packages/api-platform-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M710](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M195](/packages/sulu-sulu)[api-platform/symfony

Symfony API Platform integration

354.0M107](/packages/api-platform-symfony)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M506](/packages/shopware-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)

PHPackages © 2026

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