PHPackages                             bitexpert/captainhook-infection - 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. bitexpert/captainhook-infection

ActiveLibrary[Testing &amp; Quality](/categories/testing)

bitexpert/captainhook-infection
===============================

Captain Hook Plugin to run InfectionPHP only against the files of the current changeset

v0.7.0(3y ago)125.2k36Apache-2.0PHPPHP ^8.0.0|^8.1.0|^8.2.0

Since Jan 30Pushed 2y ago2 watchersCompare

[ Source](https://github.com/bitExpert/captainhook-infection)[ Packagist](https://packagist.org/packages/bitexpert/captainhook-infection)[ RSS](/packages/bitexpert-captainhook-infection/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (7)Dependencies (12)Versions (15)Used By (6)

bitexpert/captainhook-infection
===============================

[](#bitexpertcaptainhook-infection)

This package provides an action for [Captain Hook](https://github.com/CaptainHookPhp/captainhook)which will invoke [InfectionPHP](https://infection.github.io) for all changed files of a commit. Running Infection only against the changed files will result in a faster execution of Infection which is ideal when running it as a pre-commit hook.

[![Build Status](https://github.com/bitExpert/captainhook-infection/workflows/ci/badge.svg?branch=master)](https://github.com/bitExpert/captainhook-infection/actions)[![Coverage Status](https://camo.githubusercontent.com/fd21226e0aacf4eac543e9525300fec2fd35a92c94e799d82f4958390968502e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6269744578706572742f6361707461696e686f6f6b2d696e66656374696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/bitExpert/captainhook-infection?branch=master)[![Mastodon Follow](https://camo.githubusercontent.com/c2abd2d790b2fdf042e992e8872c59044086bdb16b119a61d8526d6238c3c2ba/68747470733a2f2f696d672e736869656c64732e696f2f6d6173746f646f6e2f666f6c6c6f772f3130393430383638313234363937323730303f646f6d61696e3d68747470733a2f2f726865696e6e65636b61722e736f6369616c)](https://rheinneckar.social/@bitexpert)

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

[](#installation)

The preferred way of installing `bitexpert/captainhook-infection` is through Composer. You can add `bitexpert/captainhook-infection` as a dev dependency, as follows:

```
composer.phar require --dev bitexpert/captainhook-infection

```

Usage
-----

[](#usage)

Add the following code to your `captainhook.json` configuration file:

```
{
  "pre-commit": {
    "enabled": true,
    "actions": [
      {
        "action": "\\bitExpert\\CaptainHook\\Infection\\InfectionAction"
      }
    ]
  }
}

```

By default, the action will invoke `./vendor/bin/infection` as a command. If you need to customize the path, e.g. because you installed the .phar distribution you can do so by passing a `infection` configuration option to the action.

```
{
  "pre-commit": {
    "enabled": true,
    "actions": [
      {
        "action": "\\bitExpert\\CaptainHook\\Infection\\InfectionAction",
        "options": {
            "infection": "php infection.phar"
        }
      }
    ]
  }
}

```

To pass additional parameters to Infection, e.g. to define the number of threads used by Infection, supply an args array option like this:

```
{
  "pre-commit": {
    "enabled": true,
    "actions": [
      {
        "action": "\\bitExpert\\CaptainHook\\Infection\\InfectionAction",
        "options": {
            "args": [
                "-j4"
            ]
        }
      }
    ]
  }
}

```

Contribute
----------

[](#contribute)

Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and adapt the documentation.

Want To Contribute?
-------------------

[](#want-to-contribute)

If you feel that you have something to share, then we’d love to have you. Check out [the contributing guide](CONTRIBUTING.md) to find out how, as well as what we expect from you.

License
-------

[](#license)

Captain Hook Infection Action is released under the Apache 2.0 license.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 96% 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 ~116 days

Recently: every ~173 days

Total

7

Last Release

1270d ago

PHP version history (3 changes)v0.1.0PHP ^7.4.0|^8.0.0

v0.6.0PHP ^7.4.0|^8.0.0|^8.1.0

v0.7.0PHP ^8.0.0|^8.1.0|^8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1adf0ab660536efce10aeb97f0c90ec881110b64fbd23429fa945190df0def56?d=identicon)[shochdoerfer](/maintainers/shochdoerfer)

---

Top Contributors

[![shochdoerfer](https://avatars.githubusercontent.com/u/596449?v=4)](https://github.com/shochdoerfer "shochdoerfer (48 commits)")[![weph](https://avatars.githubusercontent.com/u/1123079?v=4)](https://github.com/weph "weph (2 commits)")

---

Tags

captainhookgitgithookphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bitexpert-captainhook-infection/health.svg)

```
[![Health](https://phpackages.com/badges/bitexpert-captainhook-infection/health.svg)](https://phpackages.com/packages/bitexpert-captainhook-infection)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14228.7M340](/packages/dms-phpunit-arraysubset-asserts)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8219.1M69](/packages/orchestra-workbench)[moxio/captainhook-eslint

Captain Hook Plugin to validate files using ESLint

1150.2k](/packages/moxio-captainhook-eslint)[captainhook/grumphp

GrumPHP-Integration for CaptainHook

113.9k](/packages/captainhook-grumphp)

PHPackages © 2026

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