PHPackages                             agtong/phpcs-git-pre-commit - 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. agtong/phpcs-git-pre-commit

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

agtong/phpcs-git-pre-commit
===========================

PHPCS check before commit

v1.0.6(2y ago)0133MITShell

Since Mar 9Pushed 2y agoCompare

[ Source](https://github.com/agtong/phpcs-git-pre-commit)[ Packagist](https://packagist.org/packages/agtong/phpcs-git-pre-commit)[ RSS](/packages/agtong-phpcs-git-pre-commit/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (5)Dependencies (1)Versions (8)Used By (0)

PHPCS git pre-commit hook
=========================

[](#phpcs-git-pre-commit-hook)

About
-----

[](#about)

Auto installed git pre-commit hook for running [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)code checking to PSR12 coding standard compliance. It checks only files that are to be committed.

Inspired by [Enforce code standards with composer, git hooks, and phpcs](http://tech.zumba.com/2014/04/14/control-code-quality/)

Requirement
-----------

[](#requirement)

You need to have a docker service named `php` that is running `php-fpm`, eg. `yiisoftware/yii2-php:7.4-fpm`.

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

[](#installation)

Install `agtong/phpcs-git-pre-commit` with composer require command:

```
composer require --dev "agtong/phpcs-git-pre-commit"

```

Or alternatively, include a dependency for `agtong/phpcs-git-pre-commit` in your composer.json file manually:

```
{
    "require-dev": {
        "agtong/phpcs-git-pre-commit": "dev-master"
    }
}

```

To enable code sniff, аdd to `post-install-cmd` and `post-update-cmd` in `composer.json` installation script:

```
"post-install-cmd": [
    "sh ./vendor/agtong/phpcs-git-pre-commit/src/setup.sh"
],
"post-update-cmd": [
    "sh ./vendor/agtong/phpcs-git-pre-commit/src/setup.sh"
]

```

Then run `composer install` or `composer update`. `pre-commit` hook will be installed or updated if it already exists.

Usage
-----

[](#usage)

Run `git commit` and pre-commit hook will check your committed files like if you run

```
docker-compose exec php /app/vendor/bin/phpcs --standard=PSR12 /path/to/file.php

```

Note: the `tests` directory is excluded form this check.

Contributing
------------

[](#contributing)

Feel free to make pull requests!

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~219 days

Recently: every ~7 days

Total

7

Last Release

944d ago

### Community

Maintainers

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

---

Top Contributors

[![smgladkovskiy](https://avatars.githubusercontent.com/u/128070?v=4)](https://github.com/smgladkovskiy "smgladkovskiy (12 commits)")[![sreichel](https://avatars.githubusercontent.com/u/5022236?v=4)](https://github.com/sreichel "sreichel (4 commits)")[![boryn](https://avatars.githubusercontent.com/u/807297?v=4)](https://github.com/boryn "boryn (1 commits)")[![michnovka](https://avatars.githubusercontent.com/u/16553087?v=4)](https://github.com/michnovka "michnovka (1 commits)")

### Embed Badge

![Health badge](/badges/agtong-phpcs-git-pre-commit/health.svg)

```
[![Health](https://phpackages.com/badges/agtong-phpcs-git-pre-commit/health.svg)](https://phpackages.com/packages/agtong-phpcs-git-pre-commit)
```

###  Alternatives

[shopsys/coding-standards

Coding standards definition compatible with PSR-2

20269.1k13](/packages/shopsys-coding-standards)[flyeralarm/php-code-validator

A custom coding standard for FLYERALARM

2226.9k6](/packages/flyeralarm-php-code-validator)

PHPackages © 2026

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