Command Palette

Search for a command to run...

position in category
#5

PHP static analysis tool that finds bugs in code without running it. It inspects the whole codebase for type errors, undefined variables, invalid method calls, and similar issues, even in rarely executed code paths that tests may miss.

PHPStan is widely adopted across PHP projects, with sponsors including Shopware, Craft CMS, and Inviqa. It stands out by supporting legacy code through its baseline feature, letting teams fix issues gradually, and by understanding third‑party frameworks via an extension ecosystem for Symfony, Laravel, Doctrine, and others. Unlike style-only tools such as PHP_CodeSniffer, it focuses on correctness and type safety.

Key capabilities:

  • Rule levels for incremental adoption, from basic checks to strict type analysis
  • PHPDoc annotations for generics, array shapes, and checked exceptions before PHP supports them natively
  • Extensions for frameworks and libraries to handle magic methods and dynamic behavior
  • Baseline mode to ignore existing errors and prevent new ones from being introduced
  • Composer and PHAR installation, suitable for local development and CI pipelines
  • Extensible engine for custom rules and integrations

Teams use PHPStan in CI to block buggy code before merge, to refactor legacy codebases safely, and to improve type documentation. Developers integrate it with editors and run it alongside PHPUnit and framework-specific testing for stronger guarantees.

GitHub Repositories
388
-4.4%
Trending down this week
Removed in 18 repos