Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Context Service Extension Laravel Package

friends-of-behat/context-service-extension

Deprecated Behat extension that lets you register Behat context classes as Symfony DI services and load them into a scenario-scoped container via imported service config files (XML/YAML/PHP), using the fob.context_service tag.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Dependency Injection (DI) for Behat Contexts: Enables teams to leverage Symfony’s DI container for managing Behat contexts as services, reducing boilerplate and improving maintainability. Aligns with modern PHP/Symfony practices.
  • Roadmap for Behat Modernization: Supports migration paths for teams using Behat to adopt Symfony’s ecosystem (e.g., replacing legacy context loading with DI). Note: Deprecated in favor of SymfonyExtension v2, but may still be relevant for legacy systems.
  • Build vs. Buy: Buy for teams already using Symfony’s DI or needing lightweight context management without reinventing the wheel. Avoid custom solutions if DI integration is a priority.
  • Use Cases:
    • Teams with complex Behat suites needing reusable, dependency-injected contexts (e.g., shared services like API clients, database connections).
    • Projects migrating from SymfonyExtension v1 to v2, requiring interim solutions.
    • Scenarios where scenario-scoped services are needed (e.g., per-test database setups).

When to Consider This Package

  • Adopt if:

    • Your team uses Symfony’s DI and wants to manage Behat contexts as services.
    • You’re maintaining a legacy Behat setup (SymfonyExtension v1) and need a bridge to v2.
    • You prioritize cleaner context initialization (e.g., autowiring, tagged services).
    • Your suite has reusable contexts (e.g., shared utilities across feature files).
  • Look elsewhere if:

    • You’re using SymfonyExtension v2+ (this package is deprecated; use built-in features instead).
    • Your team doesn’t use Symfony’s DI (overhead for non-Symfony projects).
    • You need active maintenance (last update: 2019; consider alternatives like behat/symfony-extension).
    • Your contexts are simple (no need for DI complexity; plain PHP classes suffice).

How to Pitch It (Stakeholders)

For Executives: "This package lets us treat Behat contexts like Symfony services—reducing duplicate code, improving test reliability, and aligning with our PHP/Symfony stack. It’s a lightweight way to modernize our test suite without rewriting everything. While deprecated, it’s a stable stopgap for teams using older Symfony versions or needing DI for contexts. Long-term, we’d migrate to SymfonyExtension v2, but this buys us time to refactor."

For Engineering: *"If we’re already using Symfony’s DI, this lets us define Behat contexts as services (e.g., @acme.api_client for API tests) with tags and autowiring. Key benefits:

  • Less boilerplate: No manual use statements or constructor chaining.
  • Scenario isolation: Services are scoped per test (e.g., fresh DB connections).
  • Symfony integration: Works seamlessly with existing services.yml/services.xml. Tradeoff: Deprecated, but trivial to replace later. Only worth it if we’re DI-heavy or migrating from v1."*

For QA/Test Teams: "This makes it easier to share reusable test logic (e.g., a UserContext with a pre-configured API client). Instead of copying/pasting setup code, we define it once in services.yml and reuse it across features. Think of it like ‘dependency injection for tests.’"

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony