A composer installer plugin that installs required git hooks upon executing composer install or composer update.
Don't require this package in your project, to which git hooks should be added. Instead require it in all packages that provide installable git hooks.
This plugin supports any hook files that are supported by git. That is, you can use any files to your hook paths, as long as they are executable in the shell and match one of the following filenames:
applypatch-msgcommit-msgpost-updatepre-applypatchpre-commitpre-pushpre-rebasepre-receiveprepare-commit-msgupdate
-
This plugin is not published on Packagist yet. To add it to your Composer-based project, add the corresponding repository for it to your
composer.json. Composer's documentation describes how to work with repositories. -
Set the
typein yourcomposer.jsontoviison-git-hooks -
Add the plugin to your
composer.jsonas a dependency:... "require": { ... "viison/composer-git-hooks-installer-plugin": "^1.0", ... }, ...
-
Define the paths to all available groups of git hooks in your
composer.json. The path of a hook group must point to a directory in your package using a path relative from the package root:... "extra": { ... "available-viison-git-hooks": { "php-project": "git-hooks/php-project/" }, ... }, ...
-
In the package you wish to use git hooks in, require all necessary
viison-git-hookspackages and specify the desired hooks:... "require": { ... "vendor/some-package-containing-hooks": "^1.0", "vendor/another-package-containing-hooks": "^2.0", ... }, ... "extra": { ... "required-viison-git-hooks": { "vendor/some-package-containing-hooks": ["php-project"], "vendor/another-package-containing-hooks": ["javascrip-project", "spell-checker"] }, ... }, ...