PHPackages                             sonrac/git-php-hook-runner - 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. sonrac/git-php-hook-runner

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sonrac/git-php-hook-runner
==========================

Pre commit hook for php projects

v1.0(2y ago)13MITPHPPHP ^7.4 | ^8.0

Since Feb 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sonrac/php-hooks)[ Packagist](https://packagist.org/packages/sonrac/git-php-hook-runner)[ RSS](/packages/sonrac-git-php-hook-runner/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (9)Versions (4)Used By (0)

Php git commit hooks runner
===========================

[](#php-git-commit-hooks-runner)

The package is a utility for git hooks configuration to speed up the work of git hooks.

Hook commands are launched in parallel and due to parallelization the hook works faster.

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

[](#installation)

```
composer require sonrac/git-php-hook-runner
```

Usages
------

[](#usages)

- Copy config

```
cp vendor/sonrac/git-hook-runner/config/hook.yaml //
```

- Edit hook configuration. Full options list see [here](docs/config-options.md)
- Create hook in `.git/hooks` directory with next content

```
#!/bin/sh

set -e

XDEBUG_MODE=off
set -e

XDEBUG_MODE=off

PROJECT_DIR="$(dirname ${0})/../../"

__docker_cmd_runner() {
  docker-compose exec -T -e XDEBUG_MODE=off php "$@"
}

CHANGED_FILES=$(git -C "$PROJECT_DIR" diff --staged --relative --name-only --diff-filter=ACMR)

if [ -z "$CHANGED_FILES" ]; then
  echo "Empty changed files list"
  exit 0;
fi

echo '\nRun PHPCS Beautifier:\n'

__docker_cmd_runner which ./vendor/bin/phpcbf
if [ $? -eq 1 ]; then
  echo "\033[41mPlease install PHPCS\033[0m"
  exit 1
fi

PHPCBF_OUTPUT=$(__docker_cmd_runner ./vendor/bin/phpcbf $CHANGED_FILES)

case $? in
  0)
    echo "\033[32mNothing found that could be fixed \033[0m"
    ;;
  1)
    echo "\033[32mPHPCBF fixed all fixable errors \033[0m"
    ;;
  2)
    echo "\033[43mSomething failed to fix. Please change your files \033[0m"
    exit 1
    ;;
esac

BEAUTIFIED_FILES=$(echo "$PHPCBF_OUTPUT" | grep 'src\|tests\|app' |  awk -v pr_dir="$PROJECT_DIR" '{print pr_dir$1}' | tr -s '\r\n' ' ');

if [ ! -z "$BEAUTIFIED_FILES" ]; then
  git add $BEAUTIFIED_FILES
fi

php ../../vendor/bin/hook hook -p   -c  $CHANGED_FILES
```

- Save hook file content
- Git execute rights for git hook

```
chmod +x .git/hook/
```

Disable hook for commit
-----------------------

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

Uncheck checkbox in commit modal dialogue if you need commit without hook runner checks

[![img.png](docs/img/disable-in-modal-dialogue.png)](docs/img/disable-in-modal-dialogue.png)

Useful Links
------------

[](#useful-links)

- [Hook runner overview](docs/overview.md)
- [Hook runner config](docs/config-options.md)

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

864d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1245037f65b027a2c38d7aa0281cd04f53ac27eaf695a60da7311254fcc99350?d=identicon)[sonrac](/maintainers/sonrac)

---

Top Contributors

[![sonrac](https://avatars.githubusercontent.com/u/3766459?v=4)](https://github.com/sonrac "sonrac (8 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sonrac-git-php-hook-runner/health.svg)

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

###  Alternatives

[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M572](/packages/shopware-core)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54743.1k4](/packages/jolicode-castor)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)

PHPackages © 2026

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