bnf/phpstan-psr-container
PHPStan dynamic return type extension for PSR-11 ContainerInterface. Improves type inference for $container->get() so services are typed correctly during static analysis. Install via Composer and include extension.neon (or use phpstan/extension-installer).
Architecture fit: The package continues to integrate seamlessly with Laravel’s PSR-11 compliant container, enhancing static analysis for get()/has() calls while aligning with PHPStan’s workflow. The explicit compatibility with PHPStan 2.x (via PR #7) strengthens its fit for modern Laravel projects using PHPStan. However, Laravel-specific customizations (e.g., dynamic bindings, closures in bind()/singleton()) remain unvalidated. The package’s reliance on PSR-11 adherence may still require manual PHPDoc annotations for non-standard container setups.
Integration feasibility: High, but now explicitly supported for PHPStan 2.x (per PR #7), reducing versioning risks. Installation remains trivial via Composer, and the extension-installer link in the README (PR #6) improves discoverability. However, the low adoption (13 stars) and unknown repository status persist as concerns, particularly for documentation and long-term support.
Technical risk: Reduced to low for PHPStan 2.x users due to explicit compatibility. However, risks remain for:
Key questions:
bind()/singleton() with closures or dynamic keys?Stack fit: Excellent for Laravel projects using PHPStan 2.x. The package’s native PSR-11 alignment and explicit PHPStan 2.x support make it a low-friction addition to existing static analysis pipelines. No breaking changes are introduced in 1.1.0, ensuring backward compatibility.
Migration path:
^2.0 (if not already) and install the package:
composer require --dev bnf/phpstan-psr-container ^1.1.0
phpstan.neon:
extensions:
bnf\phpstan\psrContainer\Extension
Compatibility: Confirmed for PHPStan 2.x; no Laravel version constraints are mentioned. Sequencing:
Maintenance: Minimal ongoing effort expected, but monitor for PHPStan 3.x compatibility. The package’s simplicity (PSR-11 focus) reduces maintenance overhead.
Support: Limited by low adoption and no public issue tracker link. Users must rely on GitHub discussions or community contributions (e.g., recent PRs from new maintainers). Consider internal documentation for Laravel-specific workarounds.
Scaling: No scalability concerns identified. Performance impact is negligible for typical Laravel container sizes.
Failure modes:
Ramp-up:
How can I help you explore Laravel packages today?