psalm/plugin-laravel
Laravel Psalm plugin for deep static analysis plus taint-based security scanning. Detect SQL injection, XSS, SSRF, shell injection, path traversal, and open redirects by tracking user input through Laravel code—without executing it. Complements Larastan/PHPStan.
composer require, psalm-laravel init), with zero runtime overhead (pure static analysis).errorLevel (1–8).psalm-baseline.xml).Js::encode()).--workers).psalm-laravel add github.@var annotations differently)../vendor/bin/psalm-laravel analyze --level 8 to baseline existing issues../vendor/bin/psalm --set-baseline=psalm-baseline.xml to suppress legacy problems.errorLevel (e.g., 8 → 4 → 1) to tighten rules.psalm-laravel add github for automated workflows.--workers) for large codebases.view-string checks).input(), query(), file()).HasFactory).TaintedSql, PossiblyUnusedMethod).| Phase | Action | Dependencies |
|---|---|---|
| Pre-Integration | Audit Laravel/PHP/Psalm versions. | Composer, CI/CD. |
| Setup | Run composer require psalm/plugin-laravel + psalm-laravel init. |
Psalm 6.x/7.x. |
| Baseline | Generate baseline with --level 8 and suppress false positives. |
Existing codebase. |
| CI Integration | Add GitHub Actions workflow. | GitHub/GitLab API access. |
| Tuning | Lower errorLevel incrementally; customize stubs. |
Developer time. |
| Complementary | Add Larastan/PHPStan for type checks. | Separate toolchain. |
psalm.xml may need updates for new Laravel features (e.g., attributes, dynamic properties).psalm-baseline.xml) require occasional pruning.docs/security.md, docs/issues/).@alies-dev) with responsive issue triage.psalm-laravel diagnose subcommand provides runtime introspection.--workers and incremental analysis.| Failure Mode | Impact | Mitigation Strategy |
|---|---|---|
| Psalm Version Incompatibility | Analysis fails or crashes. | Pin to a stable Psalm release. |
| False Positives Overload | Developers ignore warnings. | Tune errorLevel; use baseline files. |
| CI Timeouts | Builds fail due |
How can I help you explore Laravel packages today?