PHPackages                             hungpt/pre-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. hungpt/pre-commit-hook

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

hungpt/pre-commit-hook
======================

PHPCS check before commit

01PowerShell

Since May 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/thanhhungmk92/pre-commit-hook)[ Packagist](https://packagist.org/packages/hungpt/pre-commit-hook)[ RSS](/packages/hungpt-pre-commit-hook/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)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 `hungpt/pre-commit-hook` with composer require command:

```
composer require "hungpt/pre-commit-hook"

```

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

```
{
    "require-dev": {
        "hungpt/pre-commit-hook": "*"
    }
}

```

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

```
"scripts": {
    "post-install-cmd": [
        "Hungpt\\PreCommitHook\\Installer::postInstall"
    ],
    "post-update-cmd": [
        "Hungpt\\PreCommitHook\\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

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8143781?v=4)[hungpt](/maintainers/hungpt)[@hungpt](https://github.com/hungpt)

### Embed Badge

![Health badge](/badges/hungpt-pre-commit-hook/health.svg)

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

###  Alternatives

[codewithtony/larathemes

Theme Manager for Laravel 5

123.2k](/packages/codewithtony-larathemes)

PHPackages © 2026

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