(( gitHubWatchers )) (( gitHubStars )) (( gitHubForks ))

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 those of you who use GrumPHP, there is a separate package to integrate CaptainHook within GrumPHP: Captainhook - GrumPHP.


Install from a Composer package as a dev dependency (with Composer)

Make sure you have Composer and all dependencies git installed.

Require it as a dev dependency:
composer require --dev captainhook/captainhook
Create a configuration:
vendor/bin/captainhook configure
Activate the hooks:
vendor/bin/captainhook install
Run it:
php vendor/bin/captainhook