Static analysis · 6 tools
Top 6 static analysis tools for PHP applications
For type-aware bug finding and coding standards in PHP, start with PHPStan, Psalm and PHP_CodeSniffer, the three PHP-native tools on this shortlist. SonarQube, Semgrep and Codacy follow as general platforms that add code quality, security and policy governance across languages. The list is for PHP, Laravel and Symfony teams choosing where to start with static analysis.
| # | Tool | Best for | Key feature | Platforms / deployment | Pricing | More |
|---|---|---|---|---|---|---|
| 1 | PHPStanPHPStan | Type-aware bug finding in Laravel and Symfony code | Rule levels 0–10 to raise strictness gradually | Runs locally, in CI and in a Docker container | See vendor pricing page | Official site |
| 2 | PsalmVimeo | Strict type checking plus taint analysis of user input | Strictest setting can prevent almost all type-related runtime errors | Not stated on official pages | See vendor pricing page | Official site |
| 3 | PHP_CodeSnifferPHPCSStandards | Enforcing and auto-fixing coding standards | phpcs detects violations, phpcbf corrects them | Requires PHP 7.2.0 or greater; system-wide or per-project install | See vendor pricing page | Introduction |
| 4 | SonarQubeSonar | Quality gates on pull requests across many languages | Analyzes branches and pull requests across 45+ languages | Managed cloud or self-hosted server, with editor integrations | See vendor pricing page | Introduction |
| 5 | SemgrepSemgrep | Security-focused scanning in CI and the IDE | SAST, SCA and secrets scanning in one platform | CLI, CI/CD and IDEs including VS Code and JetBrains | See vendor pricing page | Official site |
| 6 | CodacyCodacy | Central policy across many projects and AI-assisted workflows | Global policy applied across all projects | Git webhooks, with agent, IDE, Git, Jira and Slack integrations | See vendor pricing page | Official site |
1 PHPStan
By PHPStan
PHPStan is an open-source static analysis tool that finds bugs in PHP code without requiring tests. It scans the whole codebase for both obvious and tricky bugs.
Why it is here: It is PHP-native, documents extensions for Symfony, Laravel and Doctrine, and is built around type-aware checks, which matches this use case most directly.
- Best for
- Type-aware bug finding in Laravel and Symfony code
- Key features
- Rule levels 0–10 to raise strictness gradually
- Baseline for adopting it on legacy code
- Extensions for Symfony, Laravel and Doctrine
- Generics, array shapes and checked exceptions via PHPDocs
- JSON, JUnit and other CI-friendly output
- Limits
- Documented for bug finding and type analysis; coding style enforcement is not described in its facts, so teams that need it should check the vendor documentation or pair it with a style tool.
- Platforms / deployment
- Runs locally, in CI and in a Docker container
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
2 Psalm
By Vimeo
Psalm is an open-source static analysis tool for PHP from Vimeo that finds code problems. It also performs taint-based security analysis alongside type checking.
Why it is here: It is a PHP-native analyzer with a strict type-checking mode, and it adds data-flow security analysis that suits teams handling request input.
- Best for
- Strict type checking plus taint analysis of user input
- Key features
- Strictest setting can prevent almost all type-related runtime errors
- Taint analysis follows user input to SQL injection and XSS
- Taint analysis runs by default alongside type checking
- Custom taint types and sources
- Can fix some bugs automatically
- Limits
- Framework-specific support for Laravel or Symfony is not described in the facts; teams that need it should check the vendor documentation.
- Platforms / deployment
- Not stated on official pages
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
3 PHP_CodeSniffer
By PHPCSStandards
PHP_CodeSniffer is a set of two PHP scripts, phpcs and phpcbf, that tokenize PHP files to detect violations of a defined coding standard. phpcbf then corrects many of them automatically.
Why it is here: It is the PHP-native choice for coding standards enforcement, which complements the bug-finding analyzers above it.
- Best for
- Enforcing and auto-fixing coding standards
- Key features
- phpcs detects violations, phpcbf corrects them
- Default standard is PSR12; others such as PEAR via --standard
- Project settings through a configuration file for CI servers
- Install via Phar, Composer, Phive or a Git clone
- Signed release Phars with provenance verification from version 3.10.3
- Limits
- It checks code against coding standards; type-aware bug finding is outside its documented scope. Individual sniffs may need additional external tools.
- Platforms / deployment
- Requires PHP 7.2.0 or greater; system-wide or per-project install
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (github.com/PHPCSStandards/PHP_CodeSniffer) · Read our introduction to PHP_CodeSniffer
4 SonarQube
By Sonar
SonarQube is a code quality and security platform that automates reviews and verification of human-written and AI-generated code. It is available as managed cloud or self-hosted server.
Why it is here: It sits after the PHP-native tools because it is a multi-language platform; it suits teams that want merge gates and one place for quality and security results.
- Best for
- Quality gates on pull requests across many languages
- Key features
- Analyzes branches and pull requests across 45+ languages
- Quality gates decide what merges and record every check
- SAST and taint analysis for injection flaws
- Secrets detection in the IDE, commits and pull requests
- Server edition can run self-managed, including air-gapped
- Limits
- The facts do not describe PHP-specific type analysis or framework support, so PHP teams should check the vendor documentation. SCA requires SonarQube Advanced Security.
- Platforms / deployment
- Managed cloud or self-hosted server, with editor integrations
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (sonarsource.com/products/sonarqube) · Read our introduction to SonarQube
5 Semgrep
By Semgrep
Semgrep is an application security platform that scans source code with AI-assisted SAST, SCA and secrets detection. It pairs deterministic static analysis with AI reasoning.
Why it is here: It is placed among the general platforms because its documented focus is application security rather than PHP types or coding standards.
- Best for
- Security-focused scanning in CI and the IDE
- Key features
- SAST, SCA and secrets scanning in one platform
- Detects issues such as IDORs and broken authorization
- PR checks on GitHub, GitLab, Bitbucket and Azure
- Runs from the CLI, CI/CD and IDEs including VS Code and JetBrains
- MCP integrations for AI tools
- Limits
- The facts do not state PHP rule coverage or type-aware analysis, so PHP teams should check the vendor documentation for PHP support.
- Platforms / deployment
- CLI, CI/CD and IDEs including VS Code and JetBrains
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
6 Codacy
By Codacy
Codacy is a platform for governing code quality, security and AI coding policies from one place. Standards are defined once and applied as a global policy across projects.
Why it is here: It comes last because it is the broadest governance platform here, aimed at engineering leaders who want shared policy across many projects.
- Best for
- Central policy across many projects and AI-assisted workflows
- Key features
- Global policy applied across all projects
- AI code review on pull requests with fix suggestions
- Scans through Git webhooks, with no CI pipeline setup
- SAST, SCA, secrets, IaC, container and DAST coverage
- Supports 49 programming languages and frameworks
- Limits
- The facts do not name PHP or its frameworks specifically, and type-aware PHP analysis is not described; teams should check the vendor documentation.
- Platforms / deployment
- Git webhooks, with agent, IDE, Git, Jira and Slack integrations
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
How we chose these tools
We looked at three things: fit with type-aware bug finding and coding standards enforcement in PHP applications, the capabilities each vendor documents, and the deployment and platform details the vendor publishes (CLI, CI, IDE, hosted or self-managed). Where a vendor page does not state PHP coverage or a platform, we say so rather than assume it.
All facts come from official vendor pages, recorded with check dates. The order reflects editorial fit for this use case: PHP-native analyzers come first, then general platforms. It does not say any tool is better overall, since they solve different problems. This list is built from documentation, not from product trials.
Order used in this guide: Ordered by PHP specificity, with PHP-native analyzers first and general platforms last.
Frequently asked questions
What is the difference between PHPStan and Psalm?
Both are open-source static analysis tools for PHP. PHPStan documents rule levels 0–10 and extensions for Symfony, Laravel and Doctrine; Psalm documents a strict mode and default taint analysis for security.
Do I need a separate tool for PHP coding standards?
PHP_CodeSniffer is documented for detecting coding standard violations with phpcs and fixing them with phpcbf. PHPStan and Psalm are documented for bug finding, so teams usually need both a bug finder and a style tool.
Can I adopt PHPStan on a legacy codebase?
PHPStan documents a baseline for adopting it on legacy code, and rule levels let you raise strictness gradually.
Which tools here can find SQL injection or XSS?
Psalm's taint analysis follows user input to find SQL injection, XSS and other vulnerabilities. SonarQube documents SAST and taint analysis for injection flaws, and Semgrep documents SAST; check each vendor's documentation for PHP coverage.
- PHPStan: phpstan.org, phpstan.org/documentation — checked 21 November 2026
- Psalm: psalm.dev, psalm.dev/docs/security_analysis — checked 21 November 2026
- PHP_CodeSniffer: github.com/PHPCSStandards/PHP_CodeSniffer, github.com/about, github.com/features — checked 21 November 2026
- SonarQube: sonarsource.com/products/sonarqube — checked 21 November 2026
- Semgrep: semgrep.dev, semgrep.dev/about, semgrep.dev/solutions/mcp — checked 21 November 2026
- Codacy: codacy.com, codacy.com/about, codacy.com/security — checked 21 November 2026
Linthelm is independent and not affiliated with the vendors listed. No vendor paid for inclusion or position. Product names belong to their owners. Features and prices change; confirm details on each official website.