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 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

Getting Started

This release is a maintenance cut (dependency pruning, PHP 7.4/8.0/8.1 matrix coverage, stronger test suite) — no new public API. Start where you would for any Laravel package:

  1. composer require <vendor>/<package> and confirm your app's PHP constraint overlaps ^7.4|^8.0|^8.1. If you're on 8.2+, run the suite once before trusting it in CI — the 8.1 upper bound is a tested range, not necessarily a hard block.
  2. Look for a service provider in vendor/<vendor>/<package>/src and check extra.laravel.providers in its composer.json for auto-discovery. If discovery is off, register manually in config/app.php.
  3. php artisan vendor:publish --provider="Vendor\Package\PackageServiceProvider" to see whether config, migrations, or views ship with it.
  4. First use case: resolve the package's entry point from the container in php artisan tinker (app(\Vendor\Package\Client::class)) before wiring it into a controller. This surfaces missing config and credential errors in isolation.

Because the release removed dependencies, the fastest smoke test is a fresh install into a scratch Laravel app — if the package was leaning on a transitive package it no longer declares, that's where it shows up.

Implementation Patterns

  • Constructor injection over facades. Bind the package's client/manager in a singleton or your own service provider and inject it. Facades are convenient in controllers but make tests brittle and hide the dependency graph.
  • Config-first setup. Keep published config out of version control only if it holds secrets; otherwise commit it so environment drift is visible in diffs. Wrap package config reads in your own config/ file when you need environment-specific defaults.
  • Adapter boundary. For anything you call in more than two places, write a thin wrapper class (App\Support\X) that delegates to the package. When the package bumps major versions or you swap it out, you change one file.
  • Queue and event integration. If the package dispatches events or exposes a job, prefer listening to its events over subclassing internals. Listeners survive minor releases; overridden protected methods do not.
  • Test doubles. Use the package's own fake/swap hook if it provides one; otherwise bind an interface in the container during tests. With the expanded test suite in this release, you can also crib assertions from vendor/.../tests to model your own integration tests.
  • CI matrix. Mirror the package's supported versions (7.4/8.0/8.1) in your own pipeline if you're a package consumer shipping to multiple runtimes. Use composer update --prefer-lowest in one job to catch undeclared-dependency regressions — directly relevant after a release that removed dependencies.

Gotchas and Tips

  • Removed dependencies are the risk, not the feature. "Remove useless dependencies" means the package now assumes more about your app's installed set. If you get a Class not found after upgrading, run composer why-not <vendor>/<package> <version> and check whether the missing class came from a package you used to get transitively. Add it explicitly to your composer.json if so.
  • Lock file discipline. Commit composer.lock for applications; do not for libraries. Upgrade in a branch, run the full suite, and read the diff of vendor/<vendor>/<package> if anything behaves oddly — maintenance releases with no changelog detail are exactly when a git diff pays for itself.
  • PHP 8.2+ is untested. Expect deprecation notices (dynamic properties, ${var} string interpolation) rather than hard failures. If you're on 8.2/8.3, add error_reporting(E_ALL & ~E_DEPRECATED) only in test bootstrap, never in production, and file an issue upstream.
  • No 7.4-only syntax assumptions. With a matrix spanning 7.4→8.1, the package can't use enums, readonly properties, or first-class callable syntax. Don't expect those features to be adopted until 7.4 is dropped — watch for that drop as the next likely breaking change.
  • Debugging resolution. php artisan about, then php artisan tinker → app()->getLoadedProviders() to confirm registration, and config('package.key') to confirm config published to the right path. Most "package doesn't work" reports are unpublished config or a cached config file — php artisan config:clear first.
  • Extension points. Prefer the package's published config and container bindings over subclassing. If you must override, bind your subclass in register() and let boot() run the package's own boot logic; binding in boot() is too late for other providers' register()-time resolutions.
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.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels