PHPackages                             miropen/mir-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. miropen/mir-php

ActiveComposer-plugin[Testing &amp; Quality](/categories/testing)

miropen/mir-php
===============

Fast static analyzer for PHP

v0.31.0(1w ago)42↓100%1MITPHPPHP &gt;=8.1CI passing

Since Apr 26Pushed 1w agoCompare

[ Source](https://github.com/jorgsowa/mir)[ Packagist](https://packagist.org/packages/miropen/mir-php)[ Docs](https://github.com/jorgsowa/mir)[ RSS](/packages/miropen-mir-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (2)Versions (30)Used By (0)

[![mir](site/src/assets/logo-hero.png)](site/src/assets/logo-hero.png)

mir
===

[](#mir)

[![Docs](https://camo.githubusercontent.com/4f12591d44e4e4f007bc99cc95fc7ec6fe87f0de6824af442c05afa62d248062/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d6a6f7267736f77612e6769746875622e696f2532466d69722d626c7565)](https://jorgsowa.github.io/mir/)

> ⚠️ **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.

**[Try the Playground →](https://jorgsowa.github.io/mir/playground)**

A fast, incremental PHP static analyzer written in Rust, inspired by [Psalm](https://psalm.dev).

Features
--------

[](#features)

- **77 diagnostic rules** across type errors, undefined symbols, dead code, taint, and more
- Sound type system — scalars, objects, generics, unions, intersections, literals, `never`, `void`
- Full type inference — return types, literal narrowing, `if`/`match`/`instanceof`/`is_string()` etc.
- Call checking — argument count and types for user-defined and built-in functions/methods
- Class analysis — inheritance, interface compliance, abstract enforcement, visibility, `readonly`, `final`
- Dead code detection — unused variables, parameters, private methods, properties, and functions
- Taint analysis — tracks data from `$_GET`/`$_POST` to HTML/SQL/shell sinks
- Incremental cache — unchanged files skipped on re-runs via SHA-256 content hashing
- Parallel analysis — rayon-powered; scales to available CPUs
- PHP 7.4–8.5 support with version-aware stub filtering
- Comprehensive built-in coverage — powered by [JetBrains phpstorm-stubs](https://github.com/JetBrains/phpstorm-stubs) (57 extensions, 500+ functions, 100+ classes)

Installation
------------

[](#installation)

### From Composer (PHP projects)

[](#from-composer-php-projects)

```
composer require --dev miropen/mir-php
vendor/bin/mir src/
```

A `post-install-cmd` hook downloads the prebuilt binary matching your version and host platform from GitHub Releases. See [docs/getting-started.md](docs/getting-started.md#installation) for supported targets.

### From crates.io

[](#from-cratesio)

```
cargo install mir-php
```

### Build from source

[](#build-from-source)

```
git clone https://github.com/jorgsowa/mir.git
cd mir
cargo build --release
# binary at target/release/mir
```

Usage
-----

[](#usage)

```
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](docs/cli.md) for the full CLI reference.

### Suppressing issues inline

[](#suppressing-issues-inline)

Silence a single false positive directly in the source with a comment, without editing config or a baseline file:

```
// @mir-ignore UndefinedClass
new ThirdPartyClass();

$obj->method();          // @mir-ignore NullMethodCall   (trailing: this line)

// @mir-ignore-next-line PossiblyNullArgument
doThing($maybeNull);
```

A bare comment above a statement annotates the statement that follows it; a trailing comment annotates its own line. List one or more `IssueKind` names (or codes such as `MIR1400`) after the directive, or omit them to suppress every issue on the target line. `@mir-ignore-file Kind …` suppresses a kind across the whole file. The `@psalm-suppress`, `@suppress`, `@phpstan-ignore-line` and `@phpstan-ignore-next-line` aliases are accepted for drop-in compatibility.

Directives are matched per physical line, so a directive written inside a string literal or heredoc body is also honored — harmless in practice, since no diagnostic is normally reported on such a line.

Documentation
-------------

[](#documentation)

Full documentation is available at **[jorgsowa.github.io/mir](https://jorgsowa.github.io/mir/)**.

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md).

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance98

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

29

Last Release

8d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/430780b0d4abfbc761d82d3defb705aeefcea09ec7b0c319ad843dcb0f048fcc?d=identicon)[Jorg Sowa](/maintainers/Jorg%20Sowa)

---

Top Contributors

[![jorgsowa](https://avatars.githubusercontent.com/u/74921107?v=4)](https://github.com/jorgsowa "jorgsowa (864 commits)")[![colinmollenhour](https://avatars.githubusercontent.com/u/38738?v=4)](https://github.com/colinmollenhour "colinmollenhour (1 commits)")

---

Tags

phpPHPStanstatic analysisanalyzerpsalm

### Embed Badge

![Health badge](/badges/miropen-mir-php/health.svg)

```
[![Health](https://phpackages.com/badges/miropen-mir-php/health.svg)](https://phpackages.com/packages/miropen-mir-php)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.4k](/packages/larastan-larastan)[phan/phan

A static analyzer for PHP

5.6k11.7M1.2k](/packages/phan-phan)[yamadashy/phpstan-friendly-formatter

Simple error formatter for PHPStan that display code frame

64728.0k46](/packages/yamadashy-phpstan-friendly-formatter)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

15104.9k4](/packages/calebdw-larastan)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
