PHPackages                             rugaard/git-hooks - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rugaard/git-hooks

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

rugaard/git-hooks
=================

Composer plugin for handling Git hooks.

1.0.0(4y ago)01032MITPHPPHP ^8.0

Since Feb 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/rugaard/git-hooks)[ Packagist](https://packagist.org/packages/rugaard/git-hooks)[ Docs](https://github.com/rugaard)[ RSS](/packages/rugaard-git-hooks/feed)WikiDiscussions main Synced 5d ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (2)

🪝 Git Hooks [![GitHub Actions (tests)](https://github.com/rugaard/git-hooks/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/rugaard/git-hooks/actions/workflows/tests.yml)
=================================================================================================================================================================================================

[](#-git-hooks-)

This is a Composer plugin, which installs an application, that manages and handles everything related to `git` hooks in your project.

📖 Table of contents
-------------------

[](#-table-of-contents)

- [Features](#-features)
    - [Git hooks in PHP](#--git-hooks-in-php)
    - [Split scripts into separate files](#--split-scripts-into-separate-files)
    - [Auto registering](#--auto-registering)
    - [Share your Git hooks](#--share-your-git-hooks)
- [Installation](#-installation)
- [Usage](#%EF%B8%8F-usage)
    - [Custom configuration](#-custom-configuration)
        - [Register scripts](#register-scripts)
        - [Disable scripts](#disable-scripts)
        - [Script parameters](#script-parameters)
- [List registered scripts](#-list-registered-scripts)
- [Create your own Git hook](#-create-your-own-git-hook)
- [License](#-license)

🌟 Features
----------

[](#-features)

### 🐘 Git hooks in PHP

[](#--git-hooks-in-php)

Web developers is not necessarily experts when it comes to shell scripting. With Git Hooks, this is no longer an issue. You can now write your plugins in PHP and can utilize all it's features.

### 🗂 Split scripts into separate files

[](#--split-scripts-into-separate-files)

If you wanted a git hook to perform serveral things, you would normally have to put it all into a single file. This increases the risk of errors, bloats the file, etc. By using this application, you can write and register each script individually. This makes it easier to read, understand and not to mention debug.

### 🪄 Auto registering

[](#--auto-registering)

The application will automatically locate git hooks from compatible packages and automatically register and enable them. This means you don't have to configure anything. You install the package with your desired git hooks and that's it.

### 📤 Share your Git hooks

[](#--share-your-git-hooks)

The purpose of this application is to separate and "modularize" the git hooks. Fx. you could create a package, with your most used git hooks from your projects and share it in a community or with your colleagues.

📦 Installation
--------------

[](#-installation)

You install the package via [Composer](https://getcomposer.org/) by using the following command:

```
composer require rugaard/git-hooks
```

⚙️ Usage
--------

[](#️-usage)

Whenever you're performing `git` actions, the application will automatically run and execute the appropriate scripts to the triggered git hooks. There is no manual involvement required.

However, it is possible to create a custom configuration file, where you can disable scripts and overwrite/append arguments, if the script supports it.

### 📝 Custom configuration

[](#-custom-configuration)

To create a custom configuration, you need to run the following command, in the root of your project:

```
./vendor/bin/git-hooks config
```

This creates a `git-hooks.config.json` file, which contains a few options: `register`, `disable` and `parameters`.

#### Register scripts

[](#register-scripts)

You can create and register your own project specific scripts, by adding it to the `register` array in the custom configuration file:

```
{
  "register": [
    "Namespace\\GitHooks\\PreCommit\\ForceIssueNumberCommand"
  ],
  "disable": [],
  "parameters": {}
}
```

#### Disable scripts

[](#disable-scripts)

You might find a git-hook collection with multiple scripts, but you are not interested in using all of them at once. Instead of skipping the entire collection or create your own collection, you can instead disable the scripts you don't want to use.

To disable a script, simply add it to `disable` array in the custom configuration file:

```
{
  "register": [],
  "disable": [
    "Namespace\\GitHooks\\PreCommit\\ValidateMessageCommand"
  ],
  "parameters": {}
}
```

#### Script parameters

[](#script-parameters)

It's possible to overwrite or append arguments to specific scripts, if these scripts supports it. This gives some form of flexibility when installing a git-hook collection from a 3rd party.

An example could be, that you wanted to change the "printer" that the installed PHPUnit script uses:

```
{
  "register": [],
  "disable": [],
  "parameters": {
    "Namespace\\GitHooks\\PrePush\\PhpTestSuiteCommand": {
      "driver": "phpunit",
      "config": "tests/phpunit.xml"
    }
  }
}
```

🧩 List registered scripts
-------------------------

[](#-list-registered-scripts)

To get an overview of which scripts are registered with the application, you can run the following command:

```
./vendor/bin/git-hooks registered
```

This command also lists the namespaces of each script, which is needed if you're [using a custom configuration file](#-custom-configuration).

🧑🏻‍💻 Create your own Git hook
-----------------------------

[](#‍-create-your-own-git-hook)

Follow the guide in the [projects Wiki](https://github.com/rugaard/git-hooks/wiki).

🚓 License
---------

[](#-license)

This package is licensed under [MIT](https://github.com/rugaard/git-hooks/blob/main/LICENSE).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1550d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f1007ed23e51422c83de722371145b5bfcb0e57199befa00a441f734af903c77?d=identicon)[rugaard](/maintainers/rugaard)

---

Top Contributors

[![rugaard](https://avatars.githubusercontent.com/u/179868?v=4)](https://github.com/rugaard "rugaard (1 commits)")

---

Tags

plugincomposergithookscomposer-plugingit-hooksrugaardmortenmorten rugaard

### Embed Badge

![Health badge](/badges/rugaard-git-hooks/health.svg)

```
[![Health](https://phpackages.com/badges/rugaard-git-hooks/health.svg)](https://phpackages.com/packages/rugaard-git-hooks)
```

###  Alternatives

[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

2994.3M16](/packages/vaimo-composer-patches)[ergebnis/composer-normalize

Provides a composer plugin for normalizing composer.json.

1.1k37.3M2.1k](/packages/ergebnis-composer-normalize)[ramsey/conventional-commits

A PHP library for creating and validating commit messages according to the Conventional Commits specification. Includes a CaptainHook action!

1931.2M122](/packages/ramsey-conventional-commits)[sllh/composer-versions-check

Checks if packages are up to date to last major versions after update

2352.4M16](/packages/sllh-composer-versions-check)[sllh/composer-lint

Extends the composer validate command with extra rules

14214.6k7](/packages/sllh-composer-lint)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
