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 4d 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 37% 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

4495d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/421c0adaa533effb16310b34396c544663167970aa9eb6940edb6ed1917c963d?d=identicon)[AydinHassan](/maintainers/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

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

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