PHPackages                             thuanpt/phpcs-commit-hook - 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. thuanpt/phpcs-commit-hook

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

thuanpt/phpcs-commit-hook
=========================

PHPCS check before commit

v1.0(6y ago)0731GPL-3.0PowerShell

Since May 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/thuanpt/phpcs-commit-hook)[ Packagist](https://packagist.org/packages/thuanpt/phpcs-commit-hook)[ RSS](/packages/thuanpt-phpcs-commit-hook/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

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

[](#universal-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 PSR2 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/) and  and  . Installer checks OS on hosting machine and installs needed hooks for platform.

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

[](#installation)

Install `thuanpt/phpcs-commit-hook` with composer require command:

```
composer require "thuanpt/phpcs-commit-hook"

```

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

```
{
    "require-dev": {
        "thuanpt/phpcs-commit-hook": "*"
    }
}

```

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

```
"scripts": {
    "post-install-cmd": [
        "PHPCodeChecker\\Installer::postInstall"
    ],
    "post-update-cmd": [
        "PHPCodeChecker\\Installer::postInstall"
    ]
}

```

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

```
php phpcs.phar --standard=PSR2 --colors --encoding=utf-8 -n -p /path/to/file.php

```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

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

2242d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13161327?v=4)[Pham Trung Thuan](/maintainers/thuanpt)[@thuanpt](https://github.com/thuanpt)

### Embed Badge

![Health badge](/badges/thuanpt-phpcs-commit-hook/health.svg)

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

###  Alternatives

[humanmade/coding-standards

Human Made Coding Standards

160443.1k59](/packages/humanmade-coding-standards)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1882.3M44](/packages/dereuromark-cakephp-ide-helper)[mediawiki/mediawiki-codesniffer

MediaWiki CodeSniffer Standards

343.2M444](/packages/mediawiki-mediawiki-codesniffer)[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

40252.8k34](/packages/ec-europa-toolkit)[shopsys/coding-standards

Coding standards definition compatible with PSR-2

20280.7k20](/packages/shopsys-coding-standards)

PHPackages © 2026

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