Infection is a free mutation-testing tool for PHP projects that checks whether tests detect changes to source code. It creates altered versions of code using predefined operators, runs tests that cover the changed lines, and records detected and surviving mutations, errors, and timeouts. Its Mutation Score Indicator reports the share of generated mutations caught by tests, alongside Mutation Code Coverage and Covered Code Mutation Score Indicator. Infection supports PHPUnit, PhpSpec, Codeception, and Testo, and runs from a project root as a CLI tool. Teams can parallelize runs, focus on changed lines or files, and configure minimum mutation scores to fail a build. Optional PHPStan and Mago integrations can help catch escaped mutants tied to type violations, dead code, and unreachable paths. It can publish reports and badges through Stryker Dashboard and emit GitHub annotations or GitLab Code Quality reports. Installation options include PHAR, Phive, Composer, Git, and Homebrew. A browser playground supports trials without local installation. Infection requires PHP 8.3 or newer and Xdebug, phpdbg, or pcov.
Who it is for
It suits PHP developers and teams who want to measure whether their tests catch code changes, including teams adding mutation-score gates to CI. The browser playground offers a way to try mutation testing without installing the command-line tools.
What is good
- Works with PHPUnit, PhpSpec, Codeception, and Testo
- Can limit analysis to changed lines or files
- Configurable mutation-score thresholds can fail builds
- Provides a browser playground without local installation
What to know first
- Requires PHP 8.3 or newer
- Needs Xdebug, phpdbg, or pcov
- Parallel runs can misreport dependent or database-backed tests
Verdict
Infection provides several ways to focus mutation testing and surface results in development workflows. Its runtime requirements and warning about parallel tests are worth checking before adopting it.
Compared on mutation testing tools
- Free plan
- Yes
- Supported languages
- PHP
- Test frameworks
- PHPUnit, PhpSpec, Codeception, Testo
- Incremental analysis
- Yes
- Parallel execution
- Yes
- Surviving mutant reports
- Yes
- Mutation quality gate
- Yes
- Mutation operators
- Arithmetic, boolean, cast, conditional boundary, conditional negotiation, equality, function signature, nullify, number, operator, regex, removal, return value, visibility, and unwrap mutators



