PHPackages                             sashas777/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. [CLI &amp; Console](/categories/cli)
4. /
5. sashas777/captainhook

ActiveLibrary[CLI &amp; Console](/categories/cli)

sashas777/captainhook
=====================

PHP git hook manager

4.5.1.2(6y ago)03511MITPHPPHP ^7.1

Since Sep 7Pushed 6y agoCompare

[ Source](https://github.com/sashas777/captainhook)[ Packagist](https://packagist.org/packages/sashas777/captainhook)[ Docs](https://github.com/captainhookphp/captainhook)[ RSS](/packages/sashas777-captainhook/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (5)Versions (44)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/588384bb095e9bb641a0a85874f97c92636f02308fac6580e7480fd1be5f0c55/68747470733a2f2f706f7365722e707567782e6f72672f6361707461696e686f6f6b2f6361707461696e686f6f6b2f762f737461626c652e7376673f763d31)](https://packagist.org/packages/captainhook/captainhook)[![Minimum PHP Version](https://camo.githubusercontent.com/824c5c4ccb56537db3b3b53bb43d7b8edc6286f3b3d1705525e0821dfd22d27e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e737667)](https://php.net/)[![Downloads](https://camo.githubusercontent.com/a9fe314ce30924bbc346bf40c6aa1fe647b932a8b6dfd024d32e8f5f70f2e0ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6361707461696e686f6f6b2f6361707461696e686f6f6b2e7376673f7631)](https://packagist.org/packages/captainhook/captainhook)[![License](https://camo.githubusercontent.com/d1cd643f8c11592fa77cf4c17e521c059adb89ffd913bd62409ba22291d5f345/68747470733a2f2f706f7365722e707567782e6f72672f6361707461696e686f6f6b2f6361707461696e686f6f6b2f6c6963656e73652e7376673f763d31)](https://packagist.org/packages/captainhook/captainhook)[![Build Status](https://camo.githubusercontent.com/27e3da5e2ef7e8c2114da13cf023f7645319dbe6c6c301c8e5c1081f71ac7e50/68747470733a2f2f7472617669732d63692e6f72672f4361707461696e486f6f6b5068702f6361707461696e686f6f6b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/CaptainHookPhp/captainhook)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/579507cc1d1fe817474c1cc0a9bee36578f5e5e35fcd299feb13ce640faa2fc1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6361707461696e686f6f6b7068702f6361707461696e686f6f6b2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d617374657226763d31)](https://scrutinizer-ci.com/g/captainhookphp/captainhook/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/245342dd840511b5d82bc5cd1da5050c5d8159883547515c1fd4a841235b8efc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6361707461696e686f6f6b7068702f6361707461696e686f6f6b2f6261646765732f636f7665726167652e706e673f623d6d617374657226763d31)](https://scrutinizer-ci.com/g/captainhookphp/captainhook/?branch=master)

CaptainHook
===========

[](#captainhook)

[![](https://camo.githubusercontent.com/61ccab5cdfa5e584f49df7fdd4c3d307e2cd1591a8c36e363c387fa5811eeb70/68747470733a2f2f6361707461696e686f6f6b7068702e6769746875622e696f2f6361707461696e686f6f6b2f6766782f63682e706e67)](https://camo.githubusercontent.com/61ccab5cdfa5e584f49df7fdd4c3d307e2cd1591a8c36e363c387fa5811eeb70/68747470733a2f2f6361707461696e686f6f6b7068702e6769746875622e696f2f6361707461696e686f6f6b2f6766782f63682e706e67)

*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").

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

[](#installation)

Use *Composer* to install *CaptainHook*.

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

If you want to make sure your whole team uses the same hooks and you want *Composer* to take care of the hook installation and activation you should use the *CaptainHook* `composer-plugin` instead.

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

The plugin will make sure that the hooks get activated after every `composer install` or `update`.

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` 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)

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": []
  }
}
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 92.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 ~26 days

Recently: every ~4 days

Total

42

Last Release

2509d ago

Major Versions

1.2.1 → 2.0.0-beta12017-01-23

2.2.0 → 3.0.02018-11-26

3.1.0 → 4.0.02019-01-10

PHP version history (3 changes)2.0.0PHP &gt;=7.0.0

4.0.0PHP &gt;=7.1.0

4.3.1PHP ^7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1823670?v=4)[sashas](/maintainers/sashas)[@sashas](https://github.com/sashas)

---

Top Contributors

[![sebastianfeldmann](https://avatars.githubusercontent.com/u/9250358?v=4)](https://github.com/sebastianfeldmann "sebastianfeldmann (368 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 (4 commits)")[![icanhazstring](https://avatars.githubusercontent.com/u/883543?v=4)](https://github.com/icanhazstring "icanhazstring (4 commits)")[![sashas777](https://avatars.githubusercontent.com/u/6912470?v=4)](https://github.com/sashas777 "sashas777 (3 commits)")[![aboks](https://avatars.githubusercontent.com/u/815524?v=4)](https://github.com/aboks "aboks (2 commits)")[![heiglandreas](https://avatars.githubusercontent.com/u/91998?v=4)](https://github.com/heiglandreas "heiglandreas (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)")[![davidjeddy](https://avatars.githubusercontent.com/u/6232455?v=4)](https://github.com/davidjeddy "davidjeddy (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![iquito](https://avatars.githubusercontent.com/u/973653?v=4)](https://github.com/iquito "iquito (1 commits)")

---

Tags

githookspre-commitpre-pushcommit-msgprepare-commit-msg

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[captainhook/captainhook

PHP git hook manager

1.1k7.4M448](/packages/captainhook-captainhook)

PHPackages © 2026

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