PHPackages                             maximumtest/php-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. [Testing &amp; Quality](/categories/testing)
4. /
5. maximumtest/php-git-hooks

ActiveLibrary[Testing &amp; Quality](/categories/testing)

maximumtest/php-git-hooks
=========================

Git hooks for PHP projects.

v5.3.4(8y ago)01541MITPHPPHP ^7.1

Since Jan 3Pushed 8y ago1 watchersCompare

[ Source](https://github.com/maximumtest/php-git-hooks)[ Packagist](https://packagist.org/packages/maximumtest/php-git-hooks)[ RSS](/packages/maximumtest-php-git-hooks/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (17)Versions (52)Used By (0)

php-git-hooks
=============

[](#php-git-hooks)

[![Build Status](https://camo.githubusercontent.com/6fe6c234939446215801f8061f80a19bbbc817c7a6fb1ef6fa3c6457e391c94e/68747470733a2f2f7472617669732d63692e6f72672f6272756c692f7068702d6769742d686f6f6b732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bruli/php-git-hooks)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/540074d208437caa6d6e99302bc3feec3b80d7171847a01e2506652c0bf4f3ff/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6272756c692f7068702d6769742d686f6f6b732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/bruli/php-git-hooks/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/b1759cd59e981f251230d6f772090000f1f4d1cced0deaaca5f0f254ea855407/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6272756c692f7068702d6769742d686f6f6b732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/bruli/php-git-hooks/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/e37a2b31b4fa450ad55763a34b8a0cb2fc750d6843df61afe0d0e3a510e585e8/68747470733a2f2f706f7365722e707567782e6f72672f6272756c692f7068702d6769742d686f6f6b732f762f737461626c652e737667)](https://packagist.org/packages/bruli/php-git-hooks) [![Total Downloads](https://camo.githubusercontent.com/ed203aa969019a518886fb1f0ecbe7d6a1480ac7d51f08fbdaa7171fde8a9308/68747470733a2f2f706f7365722e707567782e6f72672f6272756c692f7068702d6769742d686f6f6b732f646f776e6c6f616473)](https://packagist.org/packages/bruli/php-git-hooks) [![Latest Unstable Version](https://camo.githubusercontent.com/08224c6afbdadbc5e78a02077d22376218eb9570344258c3c6d938868ad02895/68747470733a2f2f706f7365722e707567782e6f72672f6272756c692f7068702d6769742d686f6f6b732f762f756e737461626c652e737667)](https://packagist.org/packages/bruli/php-git-hooks) [![License](https://camo.githubusercontent.com/1cf785b8988bc8ec9c3e06b9bab34f8352809ad071a8fa436e7889544fa93389/68747470733a2f2f706f7365722e707567782e6f72672f6272756c692f7068702d6769742d686f6f6b732f6c6963656e73652e737667)](https://packagist.org/packages/bruli/php-git-hooks)[![SensioLabsInsight](https://camo.githubusercontent.com/939ebae9656bd7c048252c9feb596310193ccaf47d34a1a981f4fcc347b10e35/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f35383465623463652d376465322d346262302d393732382d3565386265386534636133662f6d696e692e706e67)](https://insight.sensiolabs.com/projects/584eb4ce-7de2-4bb0-9728-5e8be8e4ca3f)[![Donate button](https://camo.githubusercontent.com/7b6de155df30b37b25eb5fec52f9213680c3dbf067dfb7d7e2850ac4096c7d05/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f55532f692f62746e2f62746e5f646f6e6174655f534d2e676966)](https://www.paypal.me/brulics)

Git hooks for PHP projects.

Library based in git hook scripts for PHP projects.

Installation
------------

[](#installation)

### Step 1: Composer

[](#step-1-composer)

You must add the following line to the `composer.json` file to use with Symfony 3.0:

```
{
    "require-dev": {
        "bruli/php-git-hooks": "~4.1"
    }
}
```

You can use "~2.0" for Symfony version 2.X.

Or you can write in your console:

```
$ composer require bruli/php-git-hooks --dev
```

If you don't have composer, you need download the binary file and run it:

```
$ wget http://getcomposer.org/composer.phar
# or
$ curl -O http://getcomposer.org/composer.phar

$ php composer.phar install
```

Step 2: Configuration
---------------------

[](#step-2-configuration)

### Using Composer

[](#using-composer)

First, you will need to add the following lines to your `composer.json`

```
"scripts": {
    "post-install-cmd": [
      "PhpGitHooks\\Infrastructure\\Composer\\ConfiguratorScript::buildConfig"
    ],
    "post-update-cmd": [
      "PhpGitHooks\\Infrastructure\\Composer\\ConfiguratorScript::buildConfig"
    ]
}
```

**WARNING:** "PhpGitHooks\\Application\\Composer\\ConfiguratorScript::buildConfig" is deprecated. You need change by current entry.

Then, launch `$ composer install` and composer should ask you about configuration

[![](https://raw.githubusercontent.com/bruli/php-git-hooks/master/Resources/docs/images/composer-config.png)](https://raw.githubusercontent.com/bruli/php-git-hooks/master/Resources/docs/images/composer-config.png)

### Bin directory configuration.

[](#bin-directory-configuration)

If your project doesn't have a "bin/" directory, you can add this in your `composer.json` file.

```
"config": {
    "bin-dir": "bin"
}
```

**Note:** This is not necessary for Symfony projects.

### Manual config file for git hooks.

[](#manual-config-file-for-git-hooks)

You can configure php-git-hooks, creating a php-git-hooks.yml file with...

```
pre-commit:
  enabled: true
  execute:
    php-cs-fixer:
        enabled:  true
        levels:
            psr0:       true
            psr1:       true
            psr2:       true
            symfony:    true
        options: "--fixers=short_array_syntax --diff"
    phpunit:
        enabled:     true
        random-mode: true
        options:     ''
        strict-coverage:
             enabled:       true
             minimum:       90
        guard-coverage:
             enabled: true
             message: 'WARNING!!, your code coverage is lower.'
    phplint:         true
    phpcs:
        enabled:     true
        standard:    PSR2
    phpmd:
        enabled:     true
        options:     ''
    composer:        true
  message:
    right-message: 'HEY, GOOD JOB!!'
    error-message: 'FIX YOUR CODE!!'
commit-msg:
    enabled: true
    regular-expression: '#[0-9]{2,7}'
pre-push:
    enabled: true
    execute:
      phpunit:
        enabled:     true
        random-mode: true
        options:     ''
    strict-coverage:
        enabled:       true
        minimum:       90
    guard-coverage:
        enabled: true
        message: 'WARNING!!, your code coverage is lower.'
    message:
      right-message: 'PUSH IT!!'
      error-message: 'YOU CAN NOT PUSH CODE!!'
```

... or you can copy php-git-hooks.yml.sample from vendor/bruli/php-git-hooks.

### Config file for phpunit.

[](#config-file-for-phpunit)

If you want use phpunit tool, you must create a phpunit.xml.dist in your project root directory. Alternatively you can copy from vendor/bruli/php-git-hooks/phpunit.xml.dist in your project root directory.

### Config file for phpmd.

[](#config-file-for-phpmd)

The same case that phpunit. You must create a PmdRules.xml in your project root directory or copy from php-git-hook directory.

Step 3: Enabling hooks.
-----------------------

[](#step-3-enabling-hooks)

The most easy way to enable hook is copy hook file into your .git/hooks directory.

For pre-commit hook:
====================

[](#for-pre-commit-hook)

You can enable this hooks with composer or manually executing

```
$ cp vendor/bruli/php-git-hooks/src/PhpGitHooks/Infrastructure/Hook/pre-commit .git/hooks
```

For commit-msg hook:
====================

[](#for-commit-msg-hook)

```
$ cp vendor/bruli/php-git-hooks/src/PhpGitHooks/Infrastructure/Hook/commit-msg .git/hooks
```

For pre-push hook:
==================

[](#for-pre-push-hook)

```
$ cp vendor/bruli/php-git-hooks/src/PhpGitHooks/Infrastructure/Hook/pre-push .git/hooks
```

### execute.

[](#execute)

#### Valid pre-commit.

[](#valid-pre-commit)

[![](https://raw.githubusercontent.com/bruli/php-git-hooks/master/Resources/docs/images/pre-commit.png)](https://raw.githubusercontent.com/bruli/php-git-hooks/master/Resources/docs/images/pre-commit.png)

#### Fail pre-commit.

[](#fail-pre-commit)

[![](https://raw.githubusercontent.com/bruli/php-git-hooks/master/Resources/docs/images/pre-commit-failed.png)](https://raw.githubusercontent.com/bruli/php-git-hooks/master/Resources/docs/images/pre-commit-failed.png)

Credits
-------

[](#credits)

- Pablo Braulio ([@brulics](https://twitter.com/brulics))
- [All contributors](https://github.com/bruli/php-git-hooks/graphs/contributors)

License
-------

[](#license)

php-git-hooks is released under the [MIT License](https://opensource.org/licenses/MIT). See the bundled LICENSE file for details.

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 91.8% 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

Every ~22 days

Recently: every ~7 days

Total

51

Last Release

3003d ago

Major Versions

v1.3.1 → v2.0.02015-09-01

v2.4.1 → v3.0.02015-12-08

v2.5.0 → v4.02016-02-27

4.12 → v5.02017-04-30

PHP version history (6 changes)1.1-alphaPHP &gt;=5.3.3

v1.2.0PHP &gt;=5.4

v2.0.0PHP &gt;=5.5

v2.4.0PHP &gt;=5.6

v5.0PHP ^7.0

v5.3PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2cff3f97863d030f4f8dad0b8ebb112e835c4a632b6dcc96477c2bd201eeffb9?d=identicon)[MooGeek](/maintainers/MooGeek)

---

Top Contributors

[![bruli](https://avatars.githubusercontent.com/u/760646?v=4)](https://github.com/bruli "bruli (405 commits)")[![patxi1980](https://avatars.githubusercontent.com/u/1370286?v=4)](https://github.com/patxi1980 "patxi1980 (13 commits)")[![Mr3Jane](https://avatars.githubusercontent.com/u/2467385?v=4)](https://github.com/Mr3Jane "Mr3Jane (5 commits)")[![tophsic](https://avatars.githubusercontent.com/u/930980?v=4)](https://github.com/tophsic "tophsic (3 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")[![neoshadybeat](https://avatars.githubusercontent.com/u/350521?v=4)](https://github.com/neoshadybeat "neoshadybeat (2 commits)")[![abacaphiliac](https://avatars.githubusercontent.com/u/1656273?v=4)](https://github.com/abacaphiliac "abacaphiliac (2 commits)")[![lgarciaes](https://avatars.githubusercontent.com/u/6773433?v=4)](https://github.com/lgarciaes "lgarciaes (1 commits)")[![emmetog](https://avatars.githubusercontent.com/u/1182891?v=4)](https://github.com/emmetog "emmetog (1 commits)")[![Faryshta](https://avatars.githubusercontent.com/u/2029247?v=4)](https://github.com/Faryshta "Faryshta (1 commits)")[![rbrigot](https://avatars.githubusercontent.com/u/16192061?v=4)](https://github.com/rbrigot "rbrigot (1 commits)")[![ruudy-es](https://avatars.githubusercontent.com/u/6099611?v=4)](https://github.com/ruudy-es "ruudy-es (1 commits)")[![stmswitcher](https://avatars.githubusercontent.com/u/10289021?v=4)](https://github.com/stmswitcher "stmswitcher (1 commits)")[![bryant1410](https://avatars.githubusercontent.com/u/3905501?v=4)](https://github.com/bryant1410 "bryant1410 (1 commits)")[![glensc](https://avatars.githubusercontent.com/u/199095?v=4)](https://github.com/glensc "glensc (1 commits)")[![jaceju](https://avatars.githubusercontent.com/u/310474?v=4)](https://github.com/jaceju "jaceju (1 commits)")

---

Tags

qualitygitHOOK

### Embed Badge

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

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

###  Alternatives

[bruli/php-git-hooks

Git hooks for PHP projects.

675370.8k5](/packages/bruli-php-git-hooks)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M1.9k](/packages/behat-behat)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[acquia/orca

A tool for testing a company's software packages together in the context of a realistic, functioning, best practices Drupal build

32902.4k](/packages/acquia-orca)

PHPackages © 2026

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