composer-git-hooks
![Software License][badge-license]
[![Travis][badge-travis]][link-travis]
[![Packagist][badge-packagist]][link-packagist]
[![Download][badge-downloads]][link-packagist]
Manage git hooks easily in your composer configuration. This command line tool makes it easy to implement a consistent project-wide usage of git hooks. Specifying hooks in the composer file makes them available for every member of the project team. This provides a consistent environment and behavior for everyone which is great. It is also possible to use to manage git hooks globally for every repository on your computer. That way you have a reliable set of hooks crafted by yourself for every project you choose to work on.
Install
Add a hooks section to the extra section of your composer.json and add the hooks there.
{
"extra": {
"hooks": {
"pre-commit": [
"echo committing as $(git config user.name)",
"php-cs-fixer fix ." // fix style
],
// verify commit message. ex: ABC-123: Fix everything
"commit-msg": "grep -q '[A-Z]+-[0-9]+.*' $1",
"pre-push": [
"php-cs-fixer fix --dry-run ." // check style
"phpunit"
],
"post-merge": "composer install"
"...": "..."
}
[badge-downloads]: https://img.shields.io/packagist/dt/brainmaestro/composer-git-hooks.svg?style=flat-square
[badge-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg
[badge-packagist]: https://img.shields.io/packagist/v/brainmaestro/composer-git-hooks.svg?style=flat-square
[badge-stable]: https://poser.pugx.org/your-app-rocks/eloquent-uuid/v/stable
[badge-travis]: https://img.shields.io/travis/BrainMaestro/composer-git-hooks.svg?style=flat-square
[link-author]: https://github.com/BrainMaestro
[link-composer-events]: https://getcomposer.org/doc/articles/scripts.md#command-events
[link-contributors]: ../../contributors
[link-husky]: https://github.com/typicode/husky
[link-packagist]: https://packagist.org/packages/brainmaestro/composer-git-hooks
[link-travis]: https://travis-ci.org/BrainMaestro/composer-git-hooks