sanmai/di-container
Lightweight PSR-11 compatible dependency injection container for PHP. Supports autowiring via reflection, bindings and shared services, simple configuration, and fast resolution with minimal boilerplate—suitable for small apps and libraries needing a straightforward DI container.
✅ When developing standalone libraries or microservices needing DI without framework dependencies, especially if handling optional or loosely typed dependencies. ✅ For small-to-medium PHP projects prioritizing simplicity and minimal boilerplate, now with better error handling for missing types. ✅ When needing lazy instantiation or singleton services without heavy DI tooling, with improved tolerance for incomplete type definitions. ❌ When using Laravel/Symfony (built-in DI is superior for those frameworks). ❌ For enterprise-scale applications requiring advanced features like autowiring or complex lifecycle management. ❌ If community support and long-term maintenance are critical (low stars indicate limited adoption).
Executives: "This lightweight DI container now includes graceful handling of optional dependencies, reducing runtime errors and technical debt for projects with loose type constraints. It accelerates development for small-to-medium projects and libraries while maintaining framework-agnostic flexibility—saving costs and enabling faster, more resilient feature delivery."
Engineering: "The latest update adds skip logic for missing types, making it safer to use in environments with partial type hints or optional dependencies. The minimal API remains unchanged, ensuring seamless integration for lazy instantiation, singletons, and micro-services—without sacrificing robustness."
How can I help you explore Laravel packages today?