⚠️ Experimental. mir is under active development and not yet production-ready. APIs, CLI flags, issue codes, and output formats may change between releases; expect false positives and rough edges.
A fast, incremental PHP static analyzer written in Rust, inspired by Psalm.
never, voidif/match/instanceof/is_string() etc.readonly, final$_GET/$_POST to HTML/SQL/shell sinkscargo install mir-cli
git clone --recurse-submodules https://github.com/jorgsowa/mir.git
cd mir
cargo build --release
# binary at target/release/mir
Note: The
--recurse-submodulesflag is required to initialize the phpstorm-stubs submodule that provides PHP built-in definitions. If you cloned without it, run:git submodule update --init
mir # analyze current directory
mir src/ lib/ # analyze specific paths
mir --format json src/ # machine-readable output
mir --baseline baseline.xml src/ # suppress known issues
See docs/cli.md for the full CLI reference.
| Document | Contents |
|---|---|
| docs/getting-started.md | Installation, first run, understanding output |
| docs/configuration.md | mir.xml reference, baselines, CI setup |
| docs/cli.md | All flags, output formats, exit codes |
| docs/issue-kinds.md | Every issue type mir can emit |
| docs/docblock.md | Supported docblock annotations |
| docs/architecture.md | Crate layout and analysis pipeline |
See CONTRIBUTING.md.
$x === 'foo' → TLiteralString)UnusedVariable / UnusedParam detectionUndefinedMethod / InvalidArgument false positivesPossiblyUndefinedVariable detectionMIT