PHPackages                             wunderio/code-quality - 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. wunderio/code-quality

ActivePhpcodesniffer-standard[Testing &amp; Quality](/categories/testing)

wunderio/code-quality
=====================

Code Quality checker wrapper for GrumPHP

3.0.2(7mo ago)3108.0k↓72.2%6[30 issues](https://github.com/wunderio/code-quality/issues)[3 PRs](https://github.com/wunderio/code-quality/pulls)1MITPHP

Since Sep 5Pushed 1mo ago27 watchersCompare

[ Source](https://github.com/wunderio/code-quality)[ Packagist](https://packagist.org/packages/wunderio/code-quality)[ Docs](https://github.com/wunderio/code-quality)[ RSS](/packages/wunderio-code-quality/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (14)Versions (64)Used By (1)

Code Quality
============

[](#code-quality)

[![CircleCI](https://camo.githubusercontent.com/510a87be829ab6632329663afae12d83daddd47b6583d84347afc9797c05f08d/68747470733a2f2f636972636c6563692e636f6d2f67682f77756e646572696f2f636f64652d7175616c6974792e7376673f7374796c653d737667)](https://circleci.com/gh/wunderio/code-quality)

This composer package will provide some basic code quality checks before committing code by using .

**It checks only modified files or new files on git commit, but check on all configured paths can be executed running `vendor/bin/grumphp run`**

This tool only extends [GrumPHP](https://github.com/phpro/grumphp). Please read its [documentation](https://github.com/phpro/grumphp/blob/master/README.md#configuration) on how to configure tool itself.

Checks performed
----------------

[](#checks-performed)

This repository currently has the following checks:

- Shell script exec bits - [check\_file\_permissions](src/Task/CheckFilePermissions/README.md)
- PHP Drupal CS and PHP Code security - [phpcs](src/Task/Phpcs/README.md)
- PHP 8.1 Compatibility - [php\_compatibility](src/Task/PhpCompatibility/README.md)
- PHP syntax - [php\_check\_syntax](src/Task/PhpCheckSyntax/README.md)
- Cognitive complexity and other ecs sniffs - [ecs](src/Task/Ecs/README.md)
- Yaml syntax - [yaml\_lint](src/Task/YamlLint/README.md)
- Json syntax - [json\_lint](src/Task/JsonLint/README.md)
- Deprecation testing - [php\_stan](src/Task/PhpStan/README.md)

Pre-requisites
--------------

[](#pre-requisites)

- Composer
- PHP &gt;= 8.1

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

[](#installation)

This needs to be done only once either while creating a project or enabling code checks in existing project.

```
composer require wunderio/code-quality --dev
cp vendor/wunderio/code-quality/config/grumphp.yml ./grumphp.yml
cp vendor/wunderio/code-quality/config/phpstan.neon ./phpstan.neon
cp vendor/wunderio/code-quality/config/psalm.xml ./psalm.xml

```

The commit hook for GrumPHP is automatically installed on composer require.

Customization
-------------

[](#customization)

### Configuration

[](#configuration)

Details of the configuration are broken down into the following sections.

- [Parameters](https://github.com/phpro/grumphp/blob/master/doc/parameters.md) – Configuration settings for GrumPHP itself.
- [Tasks](https://github.com/phpro/grumphp/blob/master/doc/tasks.md) – External tasks performing code validation and their respective configurations.
- [TestSuites](https://github.com/phpro/grumphp/blob/master/doc/testsuites.md)
- [Extensions](https://github.com/phpro/grumphp/blob/master/doc/extensions.md)
- [Events](https://github.com/phpro/grumphp/blob/master/doc/events.md)
- [Conventions checker](https://github.com/phpro/grumphp/blob/master/doc/conventions.md)

### Task parameters

[](#task-parameters)

If you need to customize the rules for PHP CodeSniffer then drop in phpcs.xml in the same folder as composer.json and configure grumphp.yml:

```
parameters:
  tasks:
    phpcs:
      standard:
        - phpcs.xml
```

Same applies to any task that uses other configuration file (easy-coding-standards).

**Each code quality tool allows you to define at least 3 things:**

- `run_on` - Multiple paths that will be checked and files staged must be from same path
- `ignore_patterns` - path parts that will exclude files from check
- `extensions` - file extensions of files that should be checked

Please see individual task documentation for more information on what are other configurable options.

Commands
--------

[](#commands)

Since GrumPHP is just a CLI tool, these commands can be triggered:

- [configure](https://github.com/phpro/grumphp/blob/master/doc/commands.md#installation)
- [git:init](https://github.com/phpro/grumphp/blob/master/doc/commands.md#installation)
- [git:deinit](https://github.com/phpro/grumphp/blob/master/doc/commands.md#installation)
- [git:pre-commit](https://github.com/phpro/grumphp/blob/master/doc/commands.md#git-hooks)
- [git:commit-msg](https://github.com/phpro/grumphp/blob/master/doc/commands.md#git-hooks)
- [run](https://github.com/phpro/grumphp/blob/master/doc/commands.md#run)

Usage
-----

[](#usage)

The pre-commit hook will be automatically run upon executing `git commit`.

The code scanning can be avoided by `git commit --no-verify` or `git commit -n` but is only meant for rare occasions.

You can run the checks manually with: `./vendor/bin/grumphp run`

To run specific task from the defined tasks in grumphp.yml, you can define it with `--tasks` parameter. Example:

```
./vendor/bin/grumphp run --tasks=phpcs

```

Usage in Continuous Integration
-------------------------------

[](#usage-in-continuous-integration)

You can easily use the code quality checkers on your CI (CircleCi/Jenkins/GitLab CI) by adding this line:

```
./vendor/bin/grumphp run --no-ansi --no-interaction

```

IDE Integration (optional)
--------------------------

[](#ide-integration-optional)

### Prerequisites

[](#prerequisites)

Minimally [Code Quality 2.2.1](https://github.com/wunderio/code-quality/releases/tag/2.2.1) is needed because it contains the WunderAll ruleset that groups all Wunder rulesets.

#### Ubuntu

[](#ubuntu)

To install the necessary PHP components without Apache:

```
sudo apt install php-cli php-tokenizer

```

#### macOS

[](#macos)

1. Install Homebrew if you don't have it installed already (see instructions on )
2. Install PHP with Homebrew

```
brew install php

```

### Configuration

[](#configuration-1)

#### Visual Studio Code

[](#visual-studio-code)

1. Install the [Drupal extension](https://marketplace.visualstudio.com/items?itemName=Stanislav.vscode-drupal).
2. Open the Drupal extension configuration.
3. Find "Drupal &gt; Phpcs: Args" and "Drupal &gt; Phpcbf: Args".
4. Click "Edit in settings.json" and add:

```
{
    "drupal.phpcs.args": [
        "--standard=WunderAll"
    ],
    "drupal.phpcbf.args": [
        "--standard=WunderAll"
    ]
}
```

PHPCS usage Example in Visual Studio Code: [![PHPCS Usage Example in VSC](https://user-images.githubusercontent.com/11972062/221161739-cabcd4b5-800d-4d5b-8071-9324bf2bcc08.gif)](https://user-images.githubusercontent.com/11972062/221161739-cabcd4b5-800d-4d5b-8071-9324bf2bcc08.gif)

#### PhpStorm

[](#phpstorm)

Open settings and look for PHP\_Codesniffer. Make sure these settings are the same: [![PhpStorm settings PHPCS 1/2](https://camo.githubusercontent.com/3c8df724b10e8d7109d2e53650682e94962877187506d23725e076c7054d002d/68747470733a2f2f7777772e75706c6f61642e65652f696d6167652f31363936393230312f323032342d30382d31345f31352d35392e706e67)](https://camo.githubusercontent.com/3c8df724b10e8d7109d2e53650682e94962877187506d23725e076c7054d002d/68747470733a2f2f7777772e75706c6f61642e65652f696d6167652f31363936393230312f323032342d30382d31345f31352d35392e706e67)

Check the paths and validate: [![PhpStorm settings PHPCS 2/2](https://camo.githubusercontent.com/598c00be30883c4c64959571d1a9ea14858e42b33b294eef9c3c54d5f63016ed/68747470733a2f2f7777772e75706c6f61642e65652f696d6167652f31363936393230332f323032342d30382d31345f31362d30312e706e67)](https://camo.githubusercontent.com/598c00be30883c4c64959571d1a9ea14858e42b33b294eef9c3c54d5f63016ed/68747470733a2f2f7777772e75706c6f61642e65652f696d6167652f31363936393230332f323032342d30382d31345f31362d30312e706e67)

Warnings are underlined and you can choose to fix them by right clicking: [![How to fix 1/2](https://camo.githubusercontent.com/a3f9c577a5c785d55787dd9366db1deb0ea347c5d1b84826d5b7560d1c975fe2/68747470733a2f2f7777772e75706c6f61642e65652f696d6167652f31363936393230372f323032342d30382d31345f31362d30332e706e67)](https://camo.githubusercontent.com/a3f9c577a5c785d55787dd9366db1deb0ea347c5d1b84826d5b7560d1c975fe2/68747470733a2f2f7777772e75706c6f61642e65652f696d6167652f31363936393230372f323032342d30382d31345f31362d30332e706e67)

Choose the "PHP Code Beautifier and Fixer: fix the whole file" [![How to fix 2/2](https://camo.githubusercontent.com/015ab2f5fe43a5ff1476379e031ffedca603112adc787c9eac6aec5e32e17010/68747470733a2f2f7777772e75706c6f61642e65652f696d6167652f31363936393231302f323032342d30382d31345f31362d30342e706e67)](https://camo.githubusercontent.com/015ab2f5fe43a5ff1476379e031ffedca603112adc787c9eac6aec5e32e17010/68747470733a2f2f7777772e75706c6f61642e65652f696d6167652f31363936393231302f323032342d30382d31345f31362d30342e706e67)

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance58

Moderate activity, may be stable

Popularity37

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 52.9% 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 ~65 days

Recently: every ~220 days

Total

35

Last Release

222d ago

Major Versions

0.2.0 → 1.0.02019-09-19

1.0.9 → 2.0.02020-12-08

1.x-dev → 2.1.02022-03-02

2.x-dev → 3.0.02024-05-21

### Community

Maintainers

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

---

Top Contributors

[![guncha25](https://avatars.githubusercontent.com/u/10857118?v=4)](https://github.com/guncha25 "guncha25 (135 commits)")[![hkirsman](https://avatars.githubusercontent.com/u/492375?v=4)](https://github.com/hkirsman "hkirsman (90 commits)")[![mitrpaka](https://avatars.githubusercontent.com/u/2673714?v=4)](https://github.com/mitrpaka "mitrpaka (23 commits)")[![mikkmiggur](https://avatars.githubusercontent.com/u/14977199?v=4)](https://github.com/mikkmiggur "mikkmiggur (2 commits)")[![Juhani-moilanen](https://avatars.githubusercontent.com/u/107038594?v=4)](https://github.com/Juhani-moilanen "Juhani-moilanen (2 commits)")[![laurisigaunis](https://avatars.githubusercontent.com/u/11645313?v=4)](https://github.com/laurisigaunis "laurisigaunis (1 commits)")[![alexdrupal](https://avatars.githubusercontent.com/u/38625?v=4)](https://github.com/alexdrupal "alexdrupal (1 commits)")[![mgalang](https://avatars.githubusercontent.com/u/209939?v=4)](https://github.com/mgalang "mgalang (1 commits)")

---

Tags

qualitygithooks

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wunderio-code-quality/health.svg)

```
[![Health](https://phpackages.com/badges/wunderio-code-quality/health.svg)](https://phpackages.com/packages/wunderio-code-quality)
```

###  Alternatives

[wp-cli/wp-cli-tests

WP-CLI testing framework

422.7M87](/packages/wp-cli-wp-cli-tests)[captainhook/captainhook

PHP git hook manager

1.1k6.8M367](/packages/captainhook-captainhook)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2021.0M276](/packages/drupal-core-dev)[chromatic/usher

A collection of Robo commands for use on Chromatic projects.

13534.3k1](/packages/chromatic-usher)[axelerant/drupal-quality-checker

Code quality checking tools for Drupal project.

13197.9k1](/packages/axelerant-drupal-quality-checker)

PHPackages © 2026

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