psalm/plugin-laravel
Psalm plugin for Laravel that adds deep framework-aware static analysis plus taint-based security scanning. Detects SQL injection, XSS, SSRF, shell injection, file traversal, and open redirects by tracking user input flows across functions and services.
DB::statement()) and magic properties (e.g., Eloquent relationships) dominate.composer require command, with minimal configuration (enable the plugin via CLI). No runtime overhead or code modifications are needed.e() for Blade) may not be annotated correctly, leading to overzealous warnings. The plugin mitigates this with @psalm-taint-escape + @psalm-flow rules, but custom logic (e.g., Html::entities()) might require manual stubs.psalm --init to generate a config.psalm-plugin enable psalm/plugin-laravel.psalm --set-baseline=psalm-baseline.xml to suppress existing issues.errorLevel to 4 (low) initially, then increase to 1 (high).TaintedSql errors).DB::raw() with bound parameters).laravel/breeze).psalm.xml) with Laravel-specific rules.DB::raw() with placeholders).| Phase | Action | Dependencies |
|---|---|---|
| Pre-Integration | Audit Psalm/Laravel versions; check for breaking changes. | Laravel/Psalm version matrix. |
| Setup | Install plugin; generate baseline. | composer.json, psalm.xml. |
| Validation | Run on a subset of code; validate false positives/negatives. | Manual review or security team. |
| CI Integration | Add Psalm to CI pipeline; configure error thresholds. | CI system (GitHub Actions, etc.). |
| Education | Train team on taint analysis concepts and fixes. | Documentation, workshops. |
| Optimization | Add custom stubs; refine baseline. | Community contributions or TPM effort. |
composer update with version constraints (e.g., ^4.0).psalm.xml and baseline files to avoid silent changes.SECURITY.md or PSALM.md.DB::raw() with placeholders for SQL").TaintedSql/TaintedShell over MissingTranslation.psalm --report=github for real-time notifications.How can I help you explore Laravel packages today?