PHPackages                             webgriffe/captainhook - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. webgriffe/captainhook

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

webgriffe/captainhook
=====================

Provides some useful custom actions to be used with Captain Hook (a PHP GIT hooks library)

2.1.0(4y ago)3131.1k↓24.5%[1 issues](https://github.com/webgriffe/captainhook/issues)1MITPHPPHP ^7.2 || ^8.0

Since Apr 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/webgriffe/captainhook)[ Packagist](https://packagist.org/packages/webgriffe/captainhook)[ RSS](/packages/webgriffe-captainhook/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (15)Used By (1)

Webgriffe CaptainHook
=====================

[](#webgriffe-captainhook)

A collection of useful conditions and actions to be used with [CaptainHook](https://github.com/CaptainHookPhp/captainhook).

[![Build Status](https://camo.githubusercontent.com/cdd0408096eb7fac75bca9b6bf55109e52df77f3f231aa9ca94956a1df58965c/68747470733a2f2f7472617669732d63692e6f72672f7765626772696666652f6361707461696e686f6f6b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/webgriffe/captainhook)

Install
-------

[](#install)

Given that you already have CaptainHook in your project you can simply use [Composer](https://getcomposer.org/) to have these `webgriffe/captainhook` actions available:

```
composer require --dev webgriffe/captainhook
```

Actions
-------

[](#actions)

Here follows the list of implemented actions.

### 1. Prevent forced push on protected branches

[](#1-prevent-forced-push-on-protected-branches)

For example, you can prevent forced push on `master` branch with the following CaptainHook's config:

```
    // captainhook.json
    // ...
    "pre-push": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Webgriffe\\CaptainHook\\PreventPushForce",
                "options": {"protected-branches": ["master"]}
            }
        ]
    }
    // ...
```

You can use the `protected-branches` option to add other branches to the protected branches list.

### 2. Prevent commit if the diff is included in the message

[](#2-prevent-commit-if-the-diff-is-included-in-the-message)

```
    // captainhook.json
    // ...
    "commit-msg": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Webgriffe\\CaptainHook\\PreventCommitMessageWithDiff"
            }
        ]
    },
    // ...
```

### 3. Prevent commit if some files have the same name but different case

[](#3-prevent-commit-if-some-files-have-the-same-name-but-different-case)

```
    // captainhook.json
    // ...
    "commit-msg": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Webgriffe\\CaptainHook\\PreventCommitCaseSensitiveSameFilename"
            }
        ]
    },
    // ...
```

License
-------

[](#license)

This library is under the MIT license. See the complete license in the LICENSE file.

Credits
-------

[](#credits)

Developed by [Webgriffe®](http://www.webgriffe.com/).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~86 days

Recently: every ~125 days

Total

11

Last Release

1694d ago

Major Versions

1.3.2 → 2.0.02020-05-19

PHP version history (5 changes)1.0.0PHP 7.1.\*|7.2.\*

1.3.0PHP 7.1.\*|7.2.\*|7.3.\*

2.0.0PHP 7.2.\*|7.3.\*

2.0.1PHP 7.2.\*|7.3.\*|7.4.\*

2.1.0PHP ^7.2 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![mmenozzi](https://avatars.githubusercontent.com/u/1199914?v=4)](https://github.com/mmenozzi "mmenozzi (19 commits)")[![lamasfoker](https://avatars.githubusercontent.com/u/12940668?v=4)](https://github.com/lamasfoker "lamasfoker (17 commits)")[![LucaGallinari](https://avatars.githubusercontent.com/u/5822554?v=4)](https://github.com/LucaGallinari "LucaGallinari (8 commits)")[![fabianaromagnoli](https://avatars.githubusercontent.com/u/23638004?v=4)](https://github.com/fabianaromagnoli "fabianaromagnoli (1 commits)")

### Embed Badge

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

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

###  Alternatives

[captainhook/plugin-composer

Composer-Plugin handling your git-hooks

201.9M169](/packages/captainhook-plugin-composer)[ramsey/devtools

A Composer plugin to aid PHP library and application development.

7134.7k26](/packages/ramsey-devtools)[aktuba/php-puppeteer

Extend puphpeteer

182.5k](/packages/aktuba-php-puppeteer)

PHPackages © 2026

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