PHPackages                             dzentota/captainhook-psalm - 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. dzentota/captainhook-psalm

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

dzentota/captainhook-psalm
==========================

Captain Hook Plugin to check for newly introduced Psalm errors

v0.3.2(4y ago)03MITPHPPHP ^7.2 || ^8.0

Since May 6Pushed 4y agoCompare

[ Source](https://github.com/dzentota/captainhook-psalm)[ Packagist](https://packagist.org/packages/dzentota/captainhook-psalm)[ RSS](/packages/dzentota-captainhook-psalm/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (5)Versions (7)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/b1983ca0f23739f4def587935aaf67cb3a3e92c772c1c0a2ee2abe2650348835/68747470733a2f2f706f7365722e707567782e6f72672f6d6f78696f2f6361707461696e686f6f6b2d7073616c6d2f762f737461626c65)](https://packagist.org/packages/moxio/captainhook-psalm)

moxio/captainhook-psalm
=======================

[](#moxiocaptainhook-psalm)

This project is a plugin for [CaptainHook](https://github.com/captainhookphp/captainhook) to check your staged PHP files for errors using [Psalm](https://psalm.dev/). The commit is blocked when one or more errors is detected in any of the staged PHP files.

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

[](#installation)

Install as a development dependency using composer:

```
$ composer require --dev moxio/captainhook-psalm

```

Usage
-----

[](#usage)

Add Psalm error checking as a `pre-commit`-hook to your `captainhook.json` configuration file:

```
{
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Moxio\\CaptainHook\\Psalm\\PsalmCheckAction"
            }
        ]
    }
}
```

The check is only run when committing changes to PHP files. It will thus not detect pre-existing errors in PHP files which are not staged.

The action expects [Psalm](https://github.com/vimeo/psalm) to be installed as a local Composer package (i.e. available at `vendor/vimeo/psalm`).

### Conditional usage

[](#conditional-usage)

If you want to perform Psalm-error checks only when Psalm is installed (i.e. available at `vendor/vimeo/psalm`), you can add a corresponding condition to the action:

```
{
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Moxio\\CaptainHook\\Psalm\\PsalmCheckAction",
                "conditions": [
                    {
                        "exec": "\\Moxio\\CaptainHook\\Psalm\\Condition\\PsalmInstalled"
                    }
                ]
            }
        ]
    }
}
```

This may be useful in scenarios where you have a shared CaptainHook configuration file that is [included](https://captainhookphp.github.io/captainhook/configure.html#includes) both in projects that use Psalm and projects that don't. If Psalm is installed, the action is run. In projects without Psalm, the validation is skipped.

### Influence of `projectFiles` in `psalm.xml`

[](#influence-of-projectfiles-in-psalmxml)

If this plugin detects a `psalm.xml` configuration file, this plugin will try to use the `projectFiles` configured in that file to filter the files checked by Psalm. This is done on a best-effort basis: not all constructs possible within `projectFiles` are supported, but simple directories and files (along with `ignoreFiles`) should work fine. If you encounter a situation where files aren't properly filtered, feel free to send a PR.

Versioning
----------

[](#versioning)

This project adheres to [Semantic Versioning](http://semver.org/).

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

[](#contributing)

Contributions to this project are welcome. Please make sure that your code follows the [PSR-12](https://www.php-fig.org/psr/psr-12/) extended coding style.

License
-------

[](#license)

This project is released under the MIT license.

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.7% 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 ~35 days

Total

5

Last Release

1689d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3d7176a1dd4827823dd352f15bd833425a8d47a719560a1bded654d832ed060?d=identicon)[dzentota](/maintainers/dzentota)

---

Top Contributors

[![aboks](https://avatars.githubusercontent.com/u/815524?v=4)](https://github.com/aboks "aboks (8 commits)")[![dzentota](https://avatars.githubusercontent.com/u/834595?v=4)](https://github.com/dzentota "dzentota (3 commits)")

---

Tags

phpgitpre-commitpsalmcaptainhook

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dzentota-captainhook-psalm/health.svg)

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

###  Alternatives

[captainhook/captainhook

PHP git hook manager

1.1k6.8M367](/packages/captainhook-captainhook)[moxio/captainhook-eslint

Captain Hook Plugin to validate files using ESLint

1147.9k](/packages/moxio-captainhook-eslint)[hot/phpunit-runner

The lib allows to watch phpunit tests

3066.9k4](/packages/hot-phpunit-runner)[yegor256/phprack

Light framework for automation of integration tests

254.7k](/packages/yegor256-phprack)

PHPackages © 2026

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