mnapoli/php-di
PHP-DI is a practical, feature-rich dependency injection container for PHP. It offers autowiring, constructor injection, flexible definitions, lazy dependencies, and PSR-11 compatibility, helping you build cleaner, more testable applications with minimal configuration and boilerplate.
Architecture fit
Illuminate\Container, which Laravel already ships and which is itself PSR-11 compliant.Illuminate/*, and test harnesses that need to boot a class graph without a full framework.Psr\Container\ContainerInterface runs under Laravel, Symfony, and PHP-DI unchanged. PHP-DI is useful to us less as a runtime and more as the reference implementation that proves our shared libraries are container-agnostic.Integration feasibility
Psr\Container\ContainerInterface, and register PHP-DI as a Laravel binding for consumers that type-hint PSR-11. No fork, no patching.get, has, set, factory, autowire, DI\create/DI\get/DI\env), and PHP 8 attributes cover most definition needs. A Laravel developer is productive in a day.Technical risk
Key questions
Stack fit
Illuminate/* is unwanted — Slim, PSR-15 middleware stacks, Lambda/Bref handlers, long-lived queue workers, internal CLI tools, and shared libraries consumed by multiple frameworks.Illuminate\Container in a running Laravel app; the framework's facades, service providers, queue, and testing helpers all assume it.Migration path
Compatibility
psr/container major against Laravel's constraint before adding the adapter — a version skew here surfaces as an interface-mismatch fatal at boot.Sequencing
Maintenance
psr/container bump now has two upgrade surfaces, and the one with fewer maintainers will lag.Support
Scaling
Failure modes
Ramp-up
How can I help you explore Laravel packages today?