vimeo/psalm
Psalm is a PHP static analysis tool that finds type issues, bugs, and dead code before runtime. It supports gradual typing via annotations, powerful checks, and configurable rules to improve code quality in applications and libraries.
@psalm-pure, @psalm-mutation-free) to enforce functional programming patterns, improving testability and security (e.g., taint tracking for XSS/SQLi).MissingPureAnnotation/MissingImmutableAnnotation issues in backlog grooming sessions to systematically improve codebase maintainability.TaintedLlmPrompt) to proactively block injection vulnerabilities in APIs handling user input (e.g., LLMs, database queries).Adopt Psalm if:
Look elsewhere if:
eval(), create_function()) that Psalm can’t analyze.taint-analysis plugin).*"Psalm is a self-service static analysis tool that acts like a ‘PHP linter on steroids’—catching bugs early to save dev time and reduce outages. For example, it found [X] critical null-dereference bugs in [Module Y] during our pilot, which would’ve cost [Z] hours to debug in production. By integrating Psalm into our CI, we’ll:
*"Psalm is PHPStan’s stricter, more opinionated cousin—focused on mutability and security rather than just type correctness. Key wins:
--alter to auto-fix MissingPureAnnotation issues, turning impure functions into pure ones (better for testing/parallelization).TaintedLlmPrompt and other custom rules.--init to generate a config, then ramp up with --issues=VeryWeakType."**"Psalm is like TypeScript for PHP—it’ll yell at you for:
null where a string is expected.composer require vimeo/psalm../vendor/bin/psalm --init (generates config)../vendor/bin/psalm --issues=TypeError,Nullability../vendor/bin/psalm --issues=MissingPureAnnotation.
Pro tip: Use --show-snippets to see exactly what’s wrong—no more guessing!"*How can I help you explore Laravel packages today?