Phan is a static analyzer for PHP designed to find problems in code without executing it.
It focuses on minimizing false positives, using inferred and declared type information to check whether classes, functions, variables, properties, constants, and method calls are valid and type safe. The tool is aimed at PHP projects that want configurable analysis, editor integration, and support for gradually increasing strictness as code quality improves.
This is free and open source software.
Key Features
- Verifies that methods, functions, classes, traits, interfaces, constants, properties, and variables are defined and accessible.
- Checks type safety and argument counts for method, function, and closure calls.
- Reports PHP backward compatibility issues across supported PHP 8.x releases.
- Detects array access problems, invalid return values, dead code, unused variables, redundant conditions, and unused use statements.
- Understands PHPDoc annotations, union types, generic types, array shapes, inherited annotations, deprecated elements, internal elements, suppressions, magic properties, and magic methods.
- Supports output formats including text, Checkstyle, JSON, Pylint, CSV, CodeClimate, HTML, and GitHub.
- Offers optional plugins for project-specific checks, printf format validation, PCRE validation, unreachable code detection, duplicate array keys, and coding style conventions.
- Can be used with editors and IDEs via the Language Server Protocol and daemon mode.
Website: github.com/phan/phan
Support:
Developer: Tyson Andre, Rasmus Lerdorf, and Andrew S. Morrison
License: MIT License
Phan is written in PHP. Learn PHP with our recommended free books and free tutorials.
Related Software
| PHP Linters | |
|---|---|
| PHPStan | PHP static analysis tool |
| PHP Coding Standards Fixer | Fixes your code to follow the standards |
| Mago | Extremely fast PHP linter, formatter, and static analyzer |
| Psalm | Static analysis tool |
| Phan | Static analyzer for PHP |
| PHP_CodeSniffer | Tokenizes PHP files and detects violations |
| Deptrac | Static code analysis tool for PHP projects |
| PHP Parallel Lint | Checks the syntax of PHP files in parallel |
| PHPLint | Speed up linting PHP files |
| PHPCompatibility | Coding standard for PHP_CodeSniffer |
| PHPArkitect | Define architectural rules as executable PHP code |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.