Weave 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
Phpunit Dependency Injection Bundle

Phpunit Dependency Injection Bundle Laravel Package

nicolasguilloux/phpunit-dependency-injection-bundle

A PHPUnit dependency injection bundle that lets tests resolve services from a container instead of constructing dependencies manually. Keeps test classes lean and setup simple for container-based PHP apps. Low adoption, so expect limited docs and community support.

View on GitHub
Deep Wiki
Context7

A magic bundle

Frequently asked questions about Phpunit Dependency Injection Bundle
What does nicolasguilloux/phpunit-dependency-injection-bundle do?
It bridges PHPUnit and a Symfony-style DI container so test cases can autowire real services instead of constructing dependencies manually. It is aimed at container-based PHP applications and keeps test bootstrap configuration minimal. The package has low adoption, so expect limited documentation and community support.
How do I install phpunit-dependency-injection-bundle with Composer?
Install it with Composer as a development dependency and confirm that the selected version matches your PHP runtime and framework version. Because v1.1.0 removes dependencies, review composer.lock changes before and after the update. Run a smoke test in a representative application after installation.
Does this package support Laravel, or is it only for Symfony?
The package is described as bringing Symfony's service container into PHPUnit tests, not as an official Laravel package. Laravel adoption should be treated as unverified until it is tested against your Laravel major version and PHP runtime. Do not assume framework compatibility from the package name or release notes alone.
Which PHP versions are supported by v1.1.0?
The release notes indicate testing against PHP 7.4, 8.0, and 8.1. Compatibility with PHP 8.2, PHP 8.3, and newer runtimes is not proven by the release notes. Confirm support in CI or with a short proof of concept before using newer PHP versions.
Can it inject mocks and repositories into PHPUnit test cases?
Its stated purpose is autowiring container-managed services into tests, which can include mocks, repositories, and other services. This can reduce manual wiring inside test classes. Validate the exact mocking behavior against your container configuration and the limited package documentation.
Is v1.1.0 a breaking change?
v1.1.0 is described as a maintenance release that removes useless dependencies and adds more appropriate tests, but the release notes do not explicitly confirm backward compatibility. Ask the maintainer to state whether any removed dependency was part of the public API or documented extension points. Compare composer.lock before and after upgrading to catch transitive dependency changes.
How should I test this package in a Laravel application before production?
Adopt it first in a non-production environment and run your full test suite plus package-specific smoke tests. Verify application boot, package discovery, autoloading, and any container integration points the package owns. If it is new to your stack, run a time-boxed proof of concept before broader adoption.
Does the package work with current Laravel LTS and PHP 8.2 or 8.3?
The release notes only show testing through PHP 8.1 and do not confirm support for current Laravel LTS releases. Treat newer Laravel and PHP versions as unverified until compatibility is demonstrated in CI or a spike. Ask the maintainer for an explicit support matrix before relying on it.
What are the production risks of using this package?
Risks include undeclared Laravel and PHP compatibility, hidden reliance on removed dependencies, limited CI coverage for newer runtimes, and sparse release-note detail. Low adoption also means limited community support and documentation. Use lockfile checks, targeted regression tests, and staged rollout to reduce risk.
What alternatives exist for dependency injection in PHPUnit tests?
Alternatives include manual constructor injection, PHPUnit mock builders, framework-specific test containers, and dedicated test-container helpers. Choose based on whether your application already exposes a service container and how much autowiring you need. This package is best treated as a convenience layer rather than a requirement.
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.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib