A Composer plugin to manage Git hooks directly in your composer.json file for consistent project-wide or global usage.
Composer Git Hooks is a PHP Composer plugin that allows developers to define and manage Git hooks directly in their composer.json file. It solves the problem of inconsistent Git hook setups across development teams by centralizing hook configuration, ensuring everyone uses the same pre-commit, commit-msg, or other hooks. The tool provides a CLI to add, update, remove, and test hooks, supporting both per-project and global installations.
PHP developers and teams using Composer who want to standardize Git hooks across their projects, especially those working in collaborative environments where consistent code quality and workflow practices are essential.
Developers choose Composer Git Hooks because it integrates seamlessly with Composer, eliminating the need for separate hook management scripts or tools. It offers version-controlled hook configurations, global hook support for personal workflows, and features like custom hooks and stop-on-failure control, making it a flexible and reliable alternative to manual Git hook setups.
Easily manage git hooks in your composer config
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Hooks are defined in the 'extra' section of composer.json, making them part of the codebase and ensuring all team members automatically use the same configurations through version control.
Supports global installation and commands with the --global flag, allowing developers to apply consistent personal hooks across all their repositories without per-project setup.
Allows adding custom hooks via the 'custom-hooks' config and configuring 'stop-on-failure' behavior for specific hooks, providing flexibility for tailored workflows.
Seamlessly integrates with Composer events like post-install-cmd for automatic hook updates, reducing manual steps and ensuring hooks stay in sync with dependencies.
Version 3 no longer supports hooks in the 'scripts' or 'hooks' root sections of composer.json, which can break existing setups and require migration, as noted in the README.
Global commands like 'remove' lack fallback to $COMPOSER_HOME if no directory is specified, potentially causing errors and confusion during hook management.
Using the --force option in the remove command can delete pre-existing hooks not managed by the tool, as warned in the README, leading to unintended data loss.