PHPackages                             cooperaj/behat-psr-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. cooperaj/behat-psr-extension

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

cooperaj/behat-psr-extension
============================

Provides a bootstrapped PSR7 application and PSR11 container to your behat contexts

v3.0.0(4mo ago)263.5k↓63%2MITPHPPHP ^8.3

Since Nov 20Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/cooperaj/behat-psr-extension)[ Packagist](https://packagist.org/packages/cooperaj/behat-psr-extension)[ RSS](/packages/cooperaj-behat-psr-extension/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (8)Dependencies (17)Versions (23)Used By (0)

Behat PSR Extension
===================

[](#behat-psr-extension)

[![CircleCI](https://camo.githubusercontent.com/0a277aeb3bb08be5c1b5fc245cd116fbd0373e60bfb5ea62ca7fa4c5180ed00d/68747470733a2f2f636972636c6563692e636f6d2f67682f636f6f706572616a2f62656861742d7073722d657874656e73696f6e2e7376673f7374796c653d736869656c64)](https://app.circleci.com/pipelines/github/cooperaj/behat-psr-extension)[![codecov](https://camo.githubusercontent.com/f383a817354c4fc41a840d1fd002b4dcf485929cd11bfd82df7b71eafa39d79e/68747470733a2f2f636f6465636f762e696f2f67682f636f6f706572616a2f62656861742d7073722d657874656e73696f6e2f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/cooperaj/behat-psr-extension)[![psalm](https://camo.githubusercontent.com/2950545e1e873b29ea93443fff702519455eb8fbe3f7a6e014e63418d456d983/68747470733a2f2f73686570686572642e6465762f6769746875622f636f6f706572616a2f62656861742d7073722d657874656e73696f6e2f636f7665726167652e737667)](https://shepherd.dev/github/cooperaj/behat-psr-extension)

This [Behat](http://behat.org) extension allows you to more easily test your [PSR7](https://www.php-fig.org/psr/psr-7/)/ [11](https://www.php-fig.org/psr/psr-11/) / [15](https://www.php-fig.org/psr/psr-15/) applications and gives you the ability to isolate your application components at service boundaries by injecting mocks/dummies/stubs into your running application instances at test time.

For instance, you may want to isolate outgoing HTTP calls from Guzzle and mock the responses of those. This is sometimes called *whitebox* testing.

Implementation
--------------

[](#implementation)

This builds on the work of [@ciaranmcnulty](https://github.com/ciaranmcnulty) and his [behat-psr7extension](https://github.com/ciaranmcnulty/behat-psr7extension)by injecting the built PSR7 application into the behat contexts alongside the PSR11 Container that is responsible for it. When this happens you're able to modify the running application by manipulation of the Container contents.

An example of this is the replacement of a AWS handler with a AWS mock handler, which allows you to mock responses to AWS requests as a part of your context steps definitions.

How to
------

[](#how-to)

For details of using this extension with Mink you can take a look at the included [FeatureContext.php](tests/features/contexts/FeatureContext.php)

In essence:

1. Implement either `Psr11AwareContext` or `Psr11MinkAwareContext` in your Behat context file.
    1. `Psr11AwareContext` if you are performing non-ui based "implementation" interactions.
    2. `Psr11MinkAwareContext` if you want to utilise Mink to do browser based "acceptance" interactions.
2. If using `Psr11MinkAwareContext` a trait is provided (`Acpr\Behat\Psr\Context\RuntimeMinkContext`) that implements the necessary Behat injection methods and behaviours.

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance75

Regular maintenance activity

Popularity33

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

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

Recently: every ~504 days

Total

16

Last Release

134d ago

Major Versions

v0.9.1 → v1.0.02019-11-22

v1.1.0 → v2.0.02019-12-19

v1.2.0 → v2.1.12020-01-09

v1.2.1 → v2.2.02020-01-20

v2.4.0 → v3.0.0-rc12021-11-20

PHP version history (6 changes)v0.9PHP ^7.1

v2.0.0PHP ^7.2

v2.4.0PHP ^7.2 || ^8.0

v3.0.0-rc1PHP ^8.0

v3.0.0-rc2PHP ^8.1

v3.0.0PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![cooperaj](https://avatars.githubusercontent.com/u/400210?v=4)](https://github.com/cooperaj "cooperaj (74 commits)")

---

Tags

behat-extensionhacktoberfestphp

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cooperaj-behat-psr-extension/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k251.7M11.6k](/packages/symfony-framework-bundle)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k185.6M2.4k](/packages/symfony-security-bundle)[symfony/security-http

Symfony Security Component - HTTP Integration

1.7k177.2M382](/packages/symfony-security-http)[api-platform/core

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

2.6k51.2M339](/packages/api-platform-core)

PHPackages © 2026

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