PHPackages                             yavin/behat-context-injection-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. yavin/behat-context-injection-extension

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

yavin/behat-context-injection-extension
=======================================

ability to inject other contexts to steps methods

v1.0.0(10y ago)012MITPHP

Since Apr 24Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Yavin/behat-context-injection-extension)[ Packagist](https://packagist.org/packages/yavin/behat-context-injection-extension)[ RSS](/packages/yavin-behat-context-injection-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Behat context injection extension
=================================

[](#behat-context-injection-extension)

[![Build Status](https://camo.githubusercontent.com/d65134914430970061378b7ee24062e917e9961ffa666131240840e87f1d0cc4/68747470733a2f2f7472617669732d63692e6f72672f596176696e2f62656861742d636f6e746578742d696e6a656374696f6e2d657874656e73696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Yavin/behat-context-injection-extension)

With this extension you can inject contexts into methods. It should work with Behat 3.1+

```
class MyContext implements Context
{
    /**
     * @Then I can inject context as argument
     */
    public function iCanInjectContextAsArgument(MyOtherContextClass $myOtherContext)
    {
        $myOtherContext->someMethod();
    }

    //...
}
```

Instalation
-----------

[](#instalation)

1. With composer.json

    ```
    composer require yavin/behat-context-injection-extension:~1.0

    ```
2. Add extension to `behat.yml`

    ```
    default:
        suites:
            example:
                paths: [ %paths.base%/my/features/path ]
                contexts:
                    - My\Context\Namespace\MyContext
                    - My\Context\Namespace\MyOtherContextClass
        extensions:
            Yavin\Behat\Extension\ContextInjection\ContextInjectionExtension: ~
    ```

example implementation in `/tests` directory

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3667d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3f940c22f0438a9116e869ec843e7e46ea6d430b7acf4424ac5c93805521592b?d=identicon)[Yavin](/maintainers/Yavin)

---

Top Contributors

[![Yavin](https://avatars.githubusercontent.com/u/1175856?v=4)](https://github.com/Yavin "Yavin (3 commits)")

### Embed Badge

![Health badge](/badges/yavin-behat-context-injection-extension/health.svg)

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

###  Alternatives

[drupal/drupal-extension

Drupal extension for Behat

22215.1M146](/packages/drupal-drupal-extension)[friends-of-behat/symfony-extension

Integrates Behat with Symfony.

48223.4M546](/packages/friends-of-behat-symfony-extension)[friends-of-behat/variadic-extension

Variadic support for behat context arguments

2286.0M442](/packages/friends-of-behat-variadic-extension)[friends-of-behat/mink-extension

Mink extension for Behat

14034.2M465](/packages/friends-of-behat-mink-extension)[friends-of-behat/suite-settings-extension

Allows to overwrite suites' default settings.

2154.1M385](/packages/friends-of-behat-suite-settings-extension)[wp-cli/wp-cli-tests

WP-CLI testing framework

422.7M87](/packages/wp-cli-wp-cli-tests)

PHPackages © 2026

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