psr-discovery/container-implementations
Auto-discovers an available PSR-11 container at runtime by checking for well-known implementations and returning the first match. Ideal for SDKs/libraries that want PSR-11 support without hard dependencies or user configuration.
Architecture Fit
The package (container-implementations) provides PSR-11 container implementations (e.g., PsrContainer) for Laravel, aligning with Laravel’s dependency injection (DI) system. The addition of Laravel Framework ^11.0 support (LTS) ensures compatibility with modern Laravel architectures, particularly those leveraging PHP 8.2+ features like enums, read-only properties, and attributes. This is a strong fit for TPMs managing Laravel applications requiring PSR-11 containers (e.g., for testing, modularization, or third-party integrations).
Integration Feasibility
composer.json constraints).Container::bindMacro or attribute-based binding). TPMs should validate if their app relies on undocumented Laravel 10 container behaviors.foreach by reference) if the app or dependencies use them. Use phpstan/psalm to audit compatibility.Technical Risk
| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Laravel 11 DI Changes | Medium | Test service binding/resolution in a staging environment. |
| PHP 8.2 Deprecations | Low | Run php -l and static analysis tools. |
| Dependency Conflicts | Low | Update composer.json to ^1.2.0 and resolve with composer why-not. |
Key Questions
app()->bind()) or only via Facades/Service Providers?Stack Fit
PsrContainer class, but Laravel-specific features (e.g., service provider integration) won’t apply.Migration Path
composer require psr-discovery/container-implementations:^1.2.0
composer require laravel/framework:^11.0 --update-with-dependencies
php -d memory_limit=-1 tests/.phpunit with --coverage to catch deprecated usage.app()->bind(), test with Laravel 11’s container methods (e.g., bindMacro).new Illuminate\Container\Container() with new PsrContainer() if customizing the container.Compatibility
container-implementations; only minimum version bumps.ServiceProvider boot methods if relying on container internals.opcache is enabled (PHP 8.2+ requires it for performance).Sequencing
when() or unless() to isolate container changes.^1.1.1 in a dev branch if issues arise.Maintenance
Support
tightenco/ziggy or spatie/laravel-logging-telescope to trace container-related issues.Scaling
PsrContainer for service caching, ensure Laravel’s cache drivers (e.g., Redis) are optimized.Failure Modes
| Scenario | Impact | Mitigation |
|---|---|---|
| Laravel 11 DI breaking changes | Medium (app crashes) | Feature flags + rollback plan. |
| PHP 8.2 deprecation warnings | Low (runtime) | Static analysis + gradual fixes. |
| Dependency conflicts | Medium | composer why-not + manual resolution. |
Ramp-Up
bindMacro, attributes).array_unpack, named arguments).README.md with Laravel 11 + PHP 8.2 integration steps.UPGRADE.md for the migration path.ServiceProvider boot methods).pestphp or phpunit to assert PSR-11 compliance.How can I help you explore Laravel packages today?