PHPackages                             aydin-hassan/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. aydin-hassan/php-git-hooks

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

aydin-hassan/php-git-hooks
==========================

Some simple git hooks to run a variety of PHP analysis tools, including PHPUnit

0.1.0-beta3(12y ago)8141GPL V2PHP

Since Jan 23Pushed 12y ago2 watchersCompare

[ Source](https://github.com/AydinHassan/PhpGitHooks)[ Packagist](https://packagist.org/packages/aydin-hassan/php-git-hooks)[ RSS](/packages/aydin-hassan-php-git-hooks/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (4)Used By (0)

PhpGitHooks
===========

[](#phpgithooks)

[![Latest Stable Version](https://camo.githubusercontent.com/54163fc3c515d64b40991e25c4440effa4ca4eeae368bfa65c36936359735ec7/68747470733a2f2f706f7365722e707567782e6f72672f617964696e2d68617373616e2f7068702d6769742d686f6f6b732f762f737461626c652e706e67)](https://packagist.org/packages/aydin0hassan/php-git-hooks)[![Latest Unstable Version](https://camo.githubusercontent.com/90c261e164eb6bb7424df8f2973b815f46d48bada04a1b5bbab09c5c101d56a0/68747470733a2f2f706f7365722e707567782e6f72672f617964696e2d68617373616e2f7068702d6769742d686f6f6b732f762f756e737461626c652e706e67)](https://packagist.org/packages/aydin-hassan/php-git-hooks)

This project contains some simple scripts to run Unit tests and static analysis tools before allowing a commit.

Currently the tool will run:

1. PHPUnit
2. PHP Copy Paste Detector
3. PHP Code Sniffer

The tool will only run phpcs on modified files where phpcpd will be run against all files. PHPUnit will be run if there if a phpunit.xml or phpunit.xml.dist file in the root of the project.

PHP Code Sniffer will be run with ps2 coding standard and warning will be ingored (eg line limits)

This script will look for binaries in either the project's `vendor/bin` directory first and will fall back to `~/.composer/vendor/bin` so make sure the tools are installed with composer.

See [PHP-FIG](https://github.com/php-fig/fig-standards) for the coding standards.

Install tools
-------------

[](#install-tools)

```
composer global require 'phpunit/phpunit:3.7.*'
composer global require 'squizlabs/php_codesniffer:1.5.1'
composer global require 'sebastian/phpcpd=2.0.0'

```

Install hooks
-------------

[](#install-hooks)

```
composer global require 'aydin-hassan/php-git-hooks:0.1.0-beta3'
cd ~/.composer/vendor/aydin-hassan/php-git-hooks
./install.sh

```

If you have any existing repositories you should run `git init` in the root of the repo to enable the hooks in them. All new repos will inherit the hooks.

Done
----

[](#done)

Everytime you commit something from any newly cloned/ created repository these checks will be executed!

Todo
----

[](#todo)

- Figure out how to execute global hooks if local repo hooks are defined

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

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

Every ~0 days

Total

3

Last Release

4541d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2817002?v=4)[Aydin Hassan](/maintainers/AydinHassan)[@AydinHassan](https://github.com/AydinHassan)

---

Top Contributors

[![AydinHassan](https://avatars.githubusercontent.com/u/2817002?v=4)](https://github.com/AydinHassan "AydinHassan (6 commits)")

### Embed Badge

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

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

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14228.7M341](/packages/dms-phpunit-arraysubset-asserts)[phpbenchmark/phpbenchmark

Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses

8011.5k2](/packages/phpbenchmark-phpbenchmark)

PHPackages © 2026

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