MinkExtension

Mink browser-automation integration and configuration layer for the Behat BDD framework.

Library
Composer
vv3.0.0-ALPHA.1
140stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
75/100Good
Development Activity72
Maintenance68
Community80
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture80
Code Quality78
Innovation68
Learning Curve70

MinkExtension wires the Mink browser-abstraction library into Behat, so PHP teams can drive real browsers and headless HTTP clients directly from their Gherkin scenarios. It ships ready-to-use context classes, session management, and a rich configuration layer for pointing tests at Selenium, WebDriver, BrowserKit, Sauce Labs, BrowserStack, and Appium drivers.

This FriendsOfBehat fork keeps the extension maintained for modern PHP and Symfony versions, preserving the familiar MinkContext step definitions and service-container factories that thousands of acceptance-test suites already depend on.

What You Get

  • A ready-made MinkContext with common web-testing step definitions
  • Base RawMinkContext and MinkAwareContext classes to build custom contexts on
  • Driver factories for Selenium, WebDriver, BrowserKit, Sauce Labs, BrowserStack, and Appium
  • A Behat configuration schema for base URLs, sessions, and per-driver capabilities
  • Automatic session lifecycle handling and failure screenshots between scenarios

Common Use Cases

  • Writing end-to-end acceptance tests for a web application in Gherkin
  • Running the same scenarios against a headless BrowserKit client and a real browser
  • Integrating cloud browser grids like Sauce Labs or BrowserStack into a CI pipeline
  • Extending the provided contexts with project-specific navigation and assertions

Under The Hood

Architecture - The extension implements Behat’s ExtensionInterface in src/Behat/MinkExtension/ServiceContainer/MinkExtension.php, registering Mink services into Behat’s Symfony-based service container and exposing a configuration tree for sessions and drivers. Driver selection is delegated to a set of DriverFactory implementations (Selenium2, Selenium4, WebdriverClassic, BrowserKit, SauceLabs, BrowserStack, Appium) under ServiceContainer/Driver, while a SessionsListener manages session lifecycle and a FailureShowListener reacts to failed steps.

Tech Stack - Pure PHP targeting PHP ^8.3, built on behat/behat, behat/mink, and symfony/config for the configuration schema. Development uses phpspec for specs, PHPStan for static analysis, and php-cs-fixer for style, all declared in composer.json.

Code Quality - The codebase is small, focused, and organized by responsibility (Context, Listener, ServiceContainer/Driver). It ships a spec/ directory of phpspec specifications and a phpstan.neon config, indicating maintained static analysis and test coverage of the factory logic; naming follows Symfony/Behat conventions consistently.

API Design - Users interact almost entirely through YAML/PHP Behat configuration and by extending RawMinkContext or using the bundled MinkContext, which keeps the getting-started boilerplate minimal. The driver-factory abstraction makes switching browsers a config change rather than a code change, though the underlying Mink API knowledge is still required to write custom steps.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search