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
Cross Container Extension

Cross Container Extension Laravel Package

friends-of-behat/cross-container-extension

Deprecated Behat extension that lets you inject services and parameters across multiple service containers. Intended for use with FriendsOfBehat ContextServiceExtension or ServiceContainerExtension; migrate to SymfonyExtension v2 instead.

View on GitHub
Deep Wiki
Context7

:crossed_swords: [DEPRECATED] Makes possible to inject services and parameters from other containers.

Frequently asked questions about Cross Container Extension
Can I use this package to share services between Laravel’s container and Behat’s container?
Technically possible but not recommended. This package relies on Symfony’s DependencyInjection container, which is incompatible with Laravel’s PSR-11 container. You’d need a custom adapter, but Laravel’s native `app()->bind()` or `app()->instance()` methods already handle cross-service sharing without external dependencies.
Why is this package deprecated? Should I still use it for Laravel projects?
This package is deprecated since 2018 with no active maintenance. The official recommendation is to migrate to SymfonyExtension v2, which is also Symfony-focused. For Laravel, native solutions or modern alternatives like `php-di` are safer and better supported.
Does this work with Laravel’s testing stack (PHPUnit/Pest) alongside Behat?
No direct support. Laravel’s testing tools (PHPUnit/Pest) don’t integrate with Behat’s extensions. If you’re using Behat, you’d need to configure it separately, but this adds complexity without clear benefits for Laravel-specific use cases.
How do I configure this for Laravel if I must use it?
You’d need to manually bridge Symfony’s DI container with Laravel’s container via a custom `ServiceProvider`. This requires deep knowledge of both systems and risks service resolution conflicts. The `README` only covers Behat configuration, not Laravel.
Are there security risks from sharing services between Behat and Laravel’s containers?
Yes. Cross-container injection can leak test state (e.g., mocks, fake data) into production services or vice versa. Laravel’s container is designed for isolation, and mixing it with Behat’s container introduces unpredictable side effects, especially in production.
What Laravel versions does this package support?
This package has no Laravel-specific documentation or testing. It depends on Symfony v1 components, which are outdated. Laravel 5.8+ may face compatibility issues due to PHP version requirements (e.g., Symfony v1 drops support for PHP 8+).
Can I use this to inject a Laravel service (e.g., a repository) into Behat contexts?
Only with significant effort. You’d need to manually register the Laravel service in Behat’s container, but this breaks Laravel’s dependency management. Native alternatives like `app()->make()` or `app()->bind()` are simpler and more maintainable.
What are the alternatives for cross-container service injection in Laravel?
Laravel’s native `app()->bind()` or `app()->instance()` methods are the simplest solutions. For more advanced use cases, consider modern PHP packages like `php-di` or `league/container`, which offer better compatibility with Laravel’s ecosystem.
How do I test if this package works with my Laravel app?
Set up a sandbox project with Behat and Laravel. Inject a minimal service (e.g., a logger) and verify no conflicts arise. Expect issues with Laravel’s frozen container state or circular dependencies, which this package doesn’t handle natively.
Is this package maintained? Will it break with future Laravel updates?
No, it’s abandoned with no commits since 2018. Upgrading Laravel could break compatibility due to PHP version changes or container API shifts. The package’s Symfony v1 dependency is also a long-term risk.
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.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views