php-standard-library/psalm-plugin
Psalm plugin for PHP Standard Library (PSL) that improves static analysis of PSL Type specifications. It gives Psalm precise inferred types for shapes and coerce results, such as exact array shapes instead of broad unions. Install with Composer as a dev dependency and enable via psalm-plugin.
php-standard-library organization. Writing and maintaining custom Psalm return-type providers for PSL would consume engineering time without creating product differentiation. Adopting this plugin is a low-cost “buy” decision that unlocks PSL’s type system inside Psalm.Type\shape() already supplements or replaces runtime validation.array{name: string, age: int, location?: array{city: string, state: string, country: string}} instead of broad array<...> unions. This improves IDE autocomplete and catches schema drift during analysis.Validator/FormRequest validation where static guarantees are more valuable than runtime-only checks.php-standard-library/psl) for typed validation, collections, strings, or data transformation.Psl\Type\shape(), Type\optional(), coerce(), or parse() and you want precise inferred types instead of broad unions.psalm-plugin enable php-standard-library/psalm-plugin.^2.1 and Psalm v5, or PSL 2.x with plugin ~2.0.0 and Psalm v4; legacy PSL 1.x maps to plugin 1.x and Psalm v4.Type component. The plugin’s primary value is PSL-specific type inference.Type\shape() and correct handling of optional keys. It catches bugs that Psalm’s default broad unions miss, improves autocomplete, and fits naturally into CI. Setup is one command, and it does not affect production runtime.How can I help you explore Laravel packages today?