# Phan

> A static analyzer for PHP that minimizes false positives

Source: https://talira.ai/catalog/phan-f1p4xx25
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool
- Categories: [developer tools / type checking](https://talira.ai/categories/developer-tools/type-checking), [languages / php](https://talira.ai/categories/languages/php)
- Licence: MIT[^2]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [Phan](https://talira.ai/orgs/phan.md)

Phan is a static analyzer for PHP that prefers to avoid false positives: it tries to prove code incorrect rather than correct. It checks that methods, functions, classes, constants, properties and variables are defined and accessible, type safety and arity on calls and binary operations, return values, inheritance and signature compatibility, and backward compatibility across PHP 8.1 to 8.6, and can find dead, unreachable and unused code, unused variables and redundant conditions, fixing some issue types automatically. It understands union and generic types, array shapes and PHPDoc annotations, runs user and bundled plugins, and works in editors through the Language Server Protocol or its daemon mode. You install it with Composer and run phan --init to create a config.

## Links

- GitHub: https://github.com/phan/phan
- Docs: https://github.com/phan/phan/wiki

## Problems it solves

- find type errors in my PHP code before running it
- check my PHP codebase for dead code and unused variables
- catch PHP code that breaks on an older PHP 8 version

## Features

- type safety and arity checks on calls, operations and return values
- backward compatibility checks for PHP 8.1 to 8.6
- dead, unreachable and unused code detection, with automatic fixes for some issues
- union types, generics (@template), array shapes and PHPDoc annotations
- user and bundled plugins
- editor integration through the Language Server Protocol and a daemon mode

## Limitations

- Phan 6 needs PHP 8.1 or newer with the php-ast extension (a polyfill parser works without it, with slight differences in doc comment parsing)[^1]

## Trust

Overall: 0.68 out of 1.
Signals: maintenance 1.00, adoption 0.75, momentum 0.49, community 0.87, backing 0.30, extensibility 0.00.

- last commit yesterday
- 141 commits in the last 90 days
- latest release 6.0.11 46 days ago
- 5.6k GitHub stars
- 151 contributors
- has a company behind it

## Alternatives

- [Psalm](https://talira.ai/catalog/psalm-fwm4fe8q.md): Free and open source static analysis tool for finding errors in PHP code
- [PHPStan](https://talira.ai/catalog/phpstan-5dffx9mn.md): PHP static analysis that finds bugs without running your code
- [Larastan](https://talira.ai/catalog/larastan-gxbmk034.md): Adds code analysis to Laravel, improving developer productivity and code quality
- [WordPress Extensions for PHPStan](https://talira.ai/catalog/wordpress-extensions-for-phpstan-tn90qpfs.md): Static analysis for WordPress plugins and themes with PHPStan
- [mypy](https://talira.ai/catalog/mypy-b1eegf0c.md): Optional static typing for Python

## Sources

[^1]: https://github.com/phan/phan#readme (checked 28 Nov 2026)
[^2]: https://github.com/phan/phan/blob/v6/LICENSE (checked 28 Nov 2026)
