Easy to use and very flexible git hook lib for php developers
Clone or download
sebastianfeldmann Remove 'Repository' dependency
This time for realz.
After removing the dependency from the runner remove the
creation within the command as well.
Latest commit e8cd9a6 Aug 27, 2018

README.md

CaptainHook

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 your commit messages, ensure code quality or run unit tests before you commit or push changes to git.

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.

Latest Stable Version Minimum PHP Version Downloads License Build Status Scrutinizer Code Quality Code Coverage

Installation

Use Composer to install CaptainHook.

    $ composer require --dev sebastianfeldmann/captainhook

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. To finally activate the hooks you have to install them to your local .git repository. You can install the .git hooks by running the following captainhook command.

    $ vendor/bin/captainhook install

Have a look at this short installation video.

Install demo

Configuration

Here's an example captainhook.json configuration file.

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