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

Abandoned → [captainhook/captainhook](/?search=captainhook%2Fcaptainhook)Library[Utility &amp; Helpers](/categories/utility)

sebastianfeldmann/captainhook
=============================

PHP git hook manager

2.2.0(7y ago)446.9k—3.8%13MITPHPPHP &gt;=7.0.0

Since Sep 7Pushed 5y ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (26)Used By (3)

**NOTE**: This repository is abandoned, please use the official [captaionhook](https://github.com/CaptainHookPhp/captainhook) repository instead.
=================================================================================================================================================

[](#note-this-repository-is-abandoned-please-use-the-official-captaionhook-repository-instead)

CaptainHook
-----------

[](#captainhook)

[![Latest Stable Version](https://camo.githubusercontent.com/588384bb095e9bb641a0a85874f97c92636f02308fac6580e7480fd1be5f0c55/68747470733a2f2f706f7365722e707567782e6f72672f6361707461696e686f6f6b2f6361707461696e686f6f6b2f762f737461626c652e7376673f763d31)](https://packagist.org/packages/captainhook/captainhook)[![Downloads](https://camo.githubusercontent.com/a9fe314ce30924bbc346bf40c6aa1fe647b932a8b6dfd024d32e8f5f70f2e0ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6361707461696e686f6f6b2f6361707461696e686f6f6b2e7376673f7631)](https://packagist.org/packages/captainhook/captainhook)[![Build Status](https://github.com/captainhookphp/captainhook/workflows/Continuous%20Integration/badge.svg)](https://github.com/captainhookphp/captainhook/actions)[![Twitter](https://camo.githubusercontent.com/0679fa647fa5d15d52ab91659e3787415b11bd83b710b50388067935f6bd7da4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f547769747465722d2534306361707461696e686f6f6b7068702d626c75652e737667)](https://twitter.com/intent/user?screen_name=captainhookphp)

*CaptainHook* is an easy to use and very flexible git hook library for php developers. It enables you to configure your git hook actions in a simple json file.

You can use *CaptainHook* to validate or prepare your commit messages, ensure code quality or run unit tests before you commit or push changes to git. You can automatically clear local caches or install the latest composer dependencies after pulling the latest changes.

*CaptainHook* makes it easy to share hooks within your team and even can make sure that everybody in your team activates the hooks locally.

You can run cli commands, use some built in validators, or write your own PHP classes that get executed by *CaptainHook*. For more information have a look at the [documentation](https://captainhookphp.github.io/captainhook/ "CaptainHook Documentation").

Install official version
------------------------

[](#install-official-version)

Install the *CaptainHook* PHAR using [Phive](https://phar.io/) or download the PHAR from the github [release page](https://github.com/captainhookphp/captainhook/releases/latest).

```
    $ phive install captainhook
```

Or use *Composer* to install *CaptainHook*.

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

Setup
-----

[](#setup)

After installing CaptainHook you can use the *captainhook* executable to create a configuration.

```
    $ vendor/bin/captainhook configure
```

Now there should be a *captainhook.json* configuration file.

If you are not using the `composer-plugin` yet you have to activate the hooks manually by installing them to your local .git repository. To do so just run the following *captainhook* command.

```
    $ vendor/bin/captainhook install
```

Have a look at this short installation video.

[![Install demo](https://camo.githubusercontent.com/c6e1d9ac97471e3c6efe5f766b661c4d904136c325f100b0500a41eb825ac9cb/687474703a2f2f696d672e796f75747562652e636f6d2f76692f616777545a306a684444732f302e6a7067)](http://www.youtube.com/watch?v=agwTZ0jhDDs)

If you want to make sure your whole team uses the same hooks and you want to make sure everybody has the hooks installed you can use the *CaptainHook* `composer-plugin` as an addition.

```
    $ composer require --dev captainhook/plugin-composer
```

The plugin will make sure that the hooks get activated after every `composer install` or `update`. If you don't like the extra dependency just add the following `scripts` command to your `composer.json` file instead.

```
{
  "scripts": {
    "post-autoload-dump": "vendor/bin/captainhook install -f -s"
  }
}
```

Configuration
-------------

[](#configuration)

Here's an example *captainhook.json* configuration file.

```
{
  "commit-msg": {
    "enabled": true,
    "actions": [
      {
        "action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Beams",
        "options": []
      }
    ]
  },
  "pre-commit": {
    "enabled": true,
    "actions": [
      {
        "action": "phpunit"
      },
      {
        "action": "phpcs --standard=psr2 src"
      }
    ]
  },
  "pre-push": {
    "enabled": false,
    "actions": []
  }
}
```

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

[](#contributing)

So you'd like to contribute to the `CaptainHook` library? Excellent! Thank you very much. I can absolutely use your help.

Have a look at the [contribution guidelines](CONTRIBUTING.md).

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 92.3% 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 ~41 days

Recently: every ~74 days

Total

20

Last Release

2747d ago

Major Versions

1.2.1 → 2.0.0-beta12017-01-23

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9250358?v=4)[Sebastian Feldmann](/maintainers/sebastianfeldmann)[@sebastianfeldmann](https://github.com/sebastianfeldmann)

---

Top Contributors

[![sebastianfeldmann](https://avatars.githubusercontent.com/u/9250358?v=4)](https://github.com/sebastianfeldmann "sebastianfeldmann (543 commits)")[![fxedel](https://avatars.githubusercontent.com/u/7782229?v=4)](https://github.com/fxedel "fxedel (11 commits)")[![be-heiglandreas](https://avatars.githubusercontent.com/u/60882198?v=4)](https://github.com/be-heiglandreas "be-heiglandreas (7 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (5 commits)")[![icanhazstring](https://avatars.githubusercontent.com/u/883543?v=4)](https://github.com/icanhazstring "icanhazstring (4 commits)")[![heiglandreas](https://avatars.githubusercontent.com/u/91998?v=4)](https://github.com/heiglandreas "heiglandreas (3 commits)")[![aboks](https://avatars.githubusercontent.com/u/815524?v=4)](https://github.com/aboks "aboks (2 commits)")[![PurpleBooth](https://avatars.githubusercontent.com/u/133327?v=4)](https://github.com/PurpleBooth "PurpleBooth (2 commits)")[![raphaelstolt](https://avatars.githubusercontent.com/u/48225?v=4)](https://github.com/raphaelstolt "raphaelstolt (2 commits)")[![dantleech](https://avatars.githubusercontent.com/u/530801?v=4)](https://github.com/dantleech "dantleech (1 commits)")[![norgeindian](https://avatars.githubusercontent.com/u/11156287?v=4)](https://github.com/norgeindian "norgeindian (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![shochdoerfer](https://avatars.githubusercontent.com/u/596449?v=4)](https://github.com/shochdoerfer "shochdoerfer (1 commits)")[![ramsey](https://avatars.githubusercontent.com/u/42941?v=4)](https://github.com/ramsey "ramsey (1 commits)")[![spajxo](https://avatars.githubusercontent.com/u/12384486?v=4)](https://github.com/spajxo "spajxo (1 commits)")[![boesing](https://avatars.githubusercontent.com/u/2189546?v=4)](https://github.com/boesing "boesing (1 commits)")[![davidjeddy](https://avatars.githubusercontent.com/u/6232455?v=4)](https://github.com/davidjeddy "davidjeddy (1 commits)")[![iquito](https://avatars.githubusercontent.com/u/973653?v=4)](https://github.com/iquito "iquito (1 commits)")

---

Tags

githookspre-commitpre-pushcommit-msg

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[captainhook/captainhook

PHP git hook manager

1.1k6.8M370](/packages/captainhook-captainhook)[ramsey/conventional-commits

A PHP library for creating and validating commit messages according to the Conventional Commits specification. Includes a CaptainHook action!

1931.2M122](/packages/ramsey-conventional-commits)[bernardosilva/git-hooks-php

Composer git-hook package with hooks for your php projects.

2516.7k1](/packages/bernardosilva-git-hooks-php)[felipebool/crook

Crook is a simple tool to ease your life when dealing with git hooks

5813.8k](/packages/felipebool-crook)[wcm/git-php-hooks

Write git hooks with PHP, organize them on a per-project base and automatically add them

6441.1k3](/packages/wcm-git-php-hooks)[igorsgm/laravel-git-hooks

🪝• Efficiently manage Git hooks in Laravel projects. Enhance code quality, save time on reviews, and prevent bugs from entering your repository.

2931.7k1](/packages/igorsgm-laravel-git-hooks)

PHPackages © 2026

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