CheckOps home

Tools directory

I

CheckOps

Infection

Infection is a BSD-3-Clause AST-based mutation testing framework for PHP that measures test effectiveness with Mutation Score Indicator metrics, supporting PHPUnit, Pest, Codeception and phpspec.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

Introduction

Infection is a mutation testing framework for PHP. It parses your code into an abstract syntax tree, applies mutators (for example changing > to >=, removing method calls, flipping booleans or altering return values), and runs your tests against each mutant. Escaped mutants reveal code that tests execute but do not truly verify.

Infection reports a Mutation Score Indicator (MSI), along with covered-code MSI and mutation code coverage, and can fail builds with --min-msi and --min-covered-msi. It runs mutants in parallel (--threads), uses coverage data to run only relevant tests per mutant, and supports PHPUnit, Pest, Codeception and phpspec as test frameworks. For pull requests, --git-diff-filter and --git-diff-lines restrict mutation to changed code. Configuration lives in infection.json5, and reports include HTML, JSON, text, GitHub annotations and the Stryker Dashboard. Version 0.35.10 was released on 8 November 2026.

The source code is at infection/infection on GitHub under the BSD-3-Clause licence, with about 2,300 stars; the most recent commit was on 10 November 2026.

Features

  1. AST-based mutators: Many PHP-aware mutation operators.
  2. MSI metrics: MSI, covered MSI and thresholds.
  3. Framework support: PHPUnit, Pest, Codeception and phpspec.
  4. Diff-only runs: Mutate only changed code in pull requests.

Pros

  1. Free to use: Open source under the BSD-3-Clause licence, so the core tool costs nothing to use.
  2. Actively maintained: The repository had commits as recent as 10 November 2026.

Cons

  1. Needs coverage driver: Requires Xdebug, PCOV or phpdbg for coverage.
  2. Runtime cost: Full runs on big codebases take time.
composer require --dev infection/infection
vendor/bin/infection --threads=max --min-msi=70 --min-covered-msi=85
vendor/bin/infection --git-diff-lines --git-diff-base=origin/main --logger-github

Resources:

Pricing

Infection is free and open source under the BSD-3-Clause licence.

  1. PHP teams with good coverage wanting to measure test quality.
  2. CI pipelines enforcing MSI thresholds on changed code.

Conclusion

Infection is the standard mutation testing tool for PHP, mature, fast in CI and compatible with all major PHP test frameworks.

Alternatives

Other tools on CheckOps that cover similar ground. Open a page, or compare one with Infection side by side.