PHPackages                             alex-plop/phpcs-diff - 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. alex-plop/phpcs-diff

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

alex-plop/phpcs-diff
====================

Detects violations of a defined coding standard based on a git diff.

0.1.0(3y ago)04PHPPHP ^7.1 || ^7.3 || ^7.4 || ^8.0

Since Feb 1Pushed 3y agoCompare

[ Source](https://github.com/alex-plop/phpcs-diff)[ Packagist](https://packagist.org/packages/alex-plop/phpcs-diff)[ RSS](/packages/alex-plop-phpcs-diff/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

This is a fork of [olivertapping/phpcs-diff](https://github.com/olivertappin/phpcs-diff).

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

[](#installation)

The recommended method of installing this library is via [Composer](https://getcomposer.org/).

### Composer

[](#composer)

#### Global Installation

[](#global-installation)

Run the following command from your project root:

```
composer global require alex-plop/phpcs-diff

```

#### Manual Installation

[](#manual-installation)

Alternatively, you can manually include a dependency for `alex-plop/phpcs-diff` in your `composer.json` file. For example:

```
{
    "require-dev": {
        "alex-plop/phpcs-diff": "^0.1"
    }
}
```

And run `composer update alex-plop/phpcs-diff`.

### Git Clone

[](#git-clone)

You can also download the `phpcs-diff` source and create a symlink to your `/usr/bin` directory:

```
git clone https://github.com/alex-plop/phpcs-diff.git
ln -s phpcs-diff/bin/phpcs-diff /usr/bin/phpcs-diff
cd /var/www/project
phpcs-diff master -v

```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Compare the staged and unstaged files from the current folder to the HEAD of the branch.

```
phpcs-diff
```

Compare the staged files from the current folder to the . E.g. being master/main.

```
phpcs-diff
```

*Please note:*

- The `-v` flag is optional. This returns a verbose output during processing.
- You must have a `phpcs.xml` defined in your project base directory.

After running `phpcs-diff`, the executable will return an output similar to the following:

```
########## START OF PHPCS CHECK ##########
module/Poject/src/Console/Script.php
 - Line 28 (WARNING) Line exceeds 120 characters; contains 190 characters
 - Line 317 (ERROR) Blank line found at end of control structure
########### END OF PHPCS CHECK ###########

```

Currently this is the only supported format however, I will look into adding additional formats (much like `phpcs`) in the near future.

About
-----

[](#about)

`phpcs-diff` detects violations of a defined set of coding standards based on a `git diff`. It uses `phpcs` from the [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) project.

This project helps by achieving the following:

- Speeds up your CI/CD pipeline validating changed files only, rather than the whole code base.
- Allows you to migrate legacy code bases that cannot risk changing everything at once to become fully compliant to a coding standard.

This executable works by only checking the changed lines, compared to the base branch, against all failed violations for those files, so you can be confident that any new or changed code will be compliant.

This will hopefully put you in a position where your codebase will become more compliant to that coding standard over time, and maybe you will find the resource to eventually change everything, and just run `phpcs` on its own.

Requirements
------------

[](#requirements)

The latest version of `phpcs-diff` requires PHP version 5.6.0 or later.

This project also depends on `squizlabs/php_codesniffer` which is used internally to fetch the failed violations via `phpcs`.

Finally, the `league/climate` package is also installed. This is to deal with console output, but this dependency may be removed in a future release.

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

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md) for information.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

Unknown

Total

1

Last Release

1202d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/19bb047e071c17aae82d6db332924fe92fa5533228f00c967742b82e85be122c?d=identicon)[alex-plop](/maintainers/alex-plop)

---

Top Contributors

[![olivertappin](https://avatars.githubusercontent.com/u/9773040?v=4)](https://github.com/olivertappin "olivertappin (19 commits)")[![alex-plop](https://avatars.githubusercontent.com/u/40175244?v=4)](https://github.com/alex-plop "alex-plop (11 commits)")[![TotalWipeOut](https://avatars.githubusercontent.com/u/1478524?v=4)](https://github.com/TotalWipeOut "TotalWipeOut (7 commits)")[![zen1t](https://avatars.githubusercontent.com/u/9872888?v=4)](https://github.com/zen1t "zen1t (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alex-plop-phpcs-diff/health.svg)

```
[![Health](https://phpackages.com/badges/alex-plop-phpcs-diff/health.svg)](https://phpackages.com/packages/alex-plop-phpcs-diff)
```

###  Alternatives

[slevomat/coding-standard

Slevomat Coding Standard for PHP\_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.

1.5k123.5M1.8k](/packages/slevomat-coding-standard)[magento/magento-coding-standard

A set of Magento specific PHP CodeSniffer rules.

37113.4M299](/packages/magento-magento-coding-standard)[youwe/testing-suite

Contains Youwe's default testing packages for php.

13176.9k8](/packages/youwe-testing-suite)[olivertappin/phpcs-diff

Detects violations of a defined coding standard based on a git diff.

12147.6k](/packages/olivertappin-phpcs-diff)

PHPackages © 2026

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