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

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

aretche/php-code-quality
========================

Code Quality scripts that can be run via Composer in Symfony projects. (forked from karriere/code-quality)

v6.0.1(6y ago)2598Apache-2.0PHPPHP &gt;=7.1

Since May 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/aretche/php-code-quality)[ Packagist](https://packagist.org/packages/aretche/php-code-quality)[ RSS](/packages/aretche-php-code-quality/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (8)Dependencies (14)Versions (31)Used By (0)

[![Build Status](https://camo.githubusercontent.com/d302c878b0fd0a26bcd4dad333f62ad5080087adb9495e85c21b75f95c0591fe/68747470733a2f2f7472617669732d63692e6f72672f617265746368652f7068702d636f64652d7175616c6974792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/aretche/php-code-quality)[![Code Style](https://camo.githubusercontent.com/414d82fd3487e1139f6178ab75f6cc1b84f51f56fe1fc9ab5da13e11d30dfa9b/68747470733a2f2f7374796c6563692e696f2f7265706f732f3136383631353435322f736869656c64)](https://styleci.io/repos/168615452)

Code Quality for PHP packages
=============================

[](#code-quality-for-php-packages)

This package provides code quality scripts that can be run via [Composer](https://github.com/composer/composer).

The scripts also work on continous integration (CI) servers like Jenkins.

Used packages
-------------

[](#used-packages)

### [FriendsOfPHP/PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)

[](#friendsofphpphp-cs-fixer)

Currently used for fixing the code.
Fixes all files in `src` directory according Symfony coding guidelines.

This package is not used for checking (linting), because PHP\_Codesniffer prints a more readable output.

### [squizlabs/PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)

[](#squizlabsphp_codesniffer)

Currently used for checking (linting) the code.
Sniffs all files in `src` directory.

This package could also be used for fixing, but PHP-CS-Fixer does it better.

### [phpmd/phpmd](https://github.com/phpmd/phpmd)

[](#phpmdphpmd)

Used for mess detection.
Runs the defined ruleset (`config/phpmd.xml`) on all files in `src` directory.

### [phpstan/phpstan](https://github.com/phpstan/phpstan)

[](#phpstanphpstan)

Used for static analysis.
Perform static analysis on all files in `src` directory.

### [phpunit/phpunit](https://phpunit.de)

[](#phpunitphpunit)

Used for testing the code.
Must be configured with a `phpunit.xml` file in your root folder.

### [lchrusciel/api-test-case](https://github.com/lchrusciel/ApiTestCase)

[](#lchruscielapi-test-case)

Based on PHPUnit and used for testing API methods.

### [phpspec/phpspec](https://github.com/phpspec/phpspec)

[](#phpspecphpspec)

Used for testing (SpecBDD) the code.
Must be configured with a `phpspec.yml` file in your root folder.

We are using the `leanphp/phpspec-code-coverage` extension for generating coverage reports.
This extension requires a `phpspec-coverage.yml` file in your root folder and Xdebug enabled.

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

[](#installation)

Run `composer require --dev aretche/php-code-quality` to install this package.

After installing, insert the desired scripts to your `composer.json`.

```
{
    "scripts": {
        "lint": "Karriere\\CodeQuality\\CodeStyleChecker::run",
        "fix": "Karriere\\CodeQuality\\CodeStyleFixer::run",
        "md": "Karriere\\CodeQuality\\MessDetector::run",
        "static": "Karriere\\CodeQuality\\StaticAnalyzer::run",
        "unit-test": "Karriere\\CodeQuality\\UnitTest::run",
        "unit-coverage": "Karriere\\CodeQuality\\UnitCoverage::run",
        "check-coverage": "Karriere\\CodeQuality\\CloverCoverageCheck::run",
        "spec-test": "Karriere\\CodeQuality\\SpecificationTest::run",
        "spec-coverage": "Karriere\\CodeQuality\\CodeCoverage::run"
    }
}
```

Usage
-----

[](#usage)

You can run a script like this: `composer {script} -- {options}`.

> If you are using Git-Shell on Windows (or Git-Shell in Intellij Terminal on Windows), call scripts like this: `composer.bat {script}`. Otherwise colors will not work.

You can disable `TTY` by adding the `--notty` flag (needed for Jenkins).
On Windows platform it's disabled automatically.

```
composer {script} -- --env=jenkins --notty

```

### Scripts

[](#scripts)

#### `lint`

[](#lint)

```
Usage:
  lint [--] [options]

Options:
      --env    Specifiy the environment. Possible values:
               'local': prints output on command-line.
               'jenkins': generates a checkstyle report file.
      --fail   Exit with 1 if linting fails.
      --notty  Disable TTY.

```

#### `static`

[](#static)

```
Usage:
  static [--] [options]

Options:
      --env    Specifiy the environment. Possible values:
               'local': prints output on command-line.
               'jenkins': generates a json report file (phpstan.json).
      --notty  Disable TTY.

```

#### `md`

[](#md)

```
Usage:
  md [--] [options]

Options:
      --env    Specifiy the environment. Possible values:
               'local': prints output on command-line.
               'jenkins': generates a xml report file (phpmd.xml).
      --notty  Disable TTY.

```

#### `fix`

[](#fix)

```
Usage:
  fix [--] [options]

Options:
      --dry-run  Show changes to be applyed.
      --notty    Disable TTY.

```

#### `unit-test`

[](#unit-test)

```
Usage:
  unit-test [--] [options]

Options:
      --fail     Exit with 1 if tests fail.
      --notty    Disable TTY.
   -v --verbose  Increase the verbosity of messages.

```

#### `unit-coverage`

[](#unit-coverage)

```
Usage:
  unit-coverage [--] [options]

Options:
      --env    Specifiy the environment. Possible values:
               'local': generate html report in coverage directory.
               'jenkins': generates clover.xml coverage report in root directory.
      --notty  Disable TTY.

```

#### `check-coverage`

[](#check-coverage)

```
Usage:
  check-coverage [--] [options]

Options:
      --min-coverage    Specify minimal coverage level. Possible
                        values: 0, 25, 50, 100 (default)
      --fail            Exit with 1 on insufficient coverage.
      --notty           Disable TTY.

```

#### `spec-test`

[](#spec-test)

```
Usage:
  spec-test [--] [options]

Options:
      --fail     Exit with 1 if tests fail.
      --notty    Disable TTY.
   -v --verbose  Increase the verbosity of messages.

```

#### `spec-coverage`

[](#spec-coverage)

```
Usage:
  spec-coverage [--] [options]

Options:
      --env    Specifiy the environment. Possible values:
               'local': prints output on command-line.
               'jenkins': generates a JUnit report file.
      --notty  Disable TTY.

```

Using custom matchers
---------------------

[](#using-custom-matchers)

This package integrates [karriere/phpspec-matchers](https://github.com/karriereat/phpspec-matchers). In order to use the custom matchers defined in this package, please include the extension configuration in your `phpspec.yml`.

FAQ
---

[](#faq)

### Why do I have to provide two phpspec configuration files?

[](#why-do-i-have-to-provide-two-phpspec-configuration-files)

The code-coverage-extension slows down the phpspec tests, so we excluded it from the normal configuration file. Keep tests fast!

### How do I increase the verbosity of the `test`-script output?

[](#how-do-i-increase-the-verbosity-of-the-test-script-output)

Run `composer test -- -v`.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~48 days

Recently: every ~78 days

Total

28

Last Release

2349d ago

Major Versions

v1.3.1 → v2.0.02017-02-09

v2.0.0 → v3.0.02017-04-11

v3.0.0 → v4.0.02017-12-15

v4.1.0 → v5.0.02019-02-01

v5.0.6 → v6.0.02019-12-12

PHP version history (3 changes)v2.0.0-alpha.1PHP &gt;=5.6.4

v3.0.0PHP &gt;=7.0

v4.1.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b865922dde9b5ac97299a80aa62a769a26c74a10c63fe6538bfc3c89aaf05be?d=identicon)[bipiane](/maintainers/bipiane)

![](https://www.gravatar.com/avatar/56535a9fcafa70276bb348d7965ea1658e512b0854d7918495d7f865c4b09cf9?d=identicon)[aretche](/maintainers/aretche)

---

Top Contributors

[![jaylinski](https://avatars.githubusercontent.com/u/1668766?v=4)](https://github.com/jaylinski "jaylinski (6 commits)")[![k9ordon](https://avatars.githubusercontent.com/u/102591?v=4)](https://github.com/k9ordon "k9ordon (1 commits)")[![Munsio](https://avatars.githubusercontent.com/u/646513?v=4)](https://github.com/Munsio "Munsio (1 commits)")

---

Tags

symfonycode qualityscripts

### Embed Badge

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

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

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[sci3ma/symfony-grumphp

Configured GrumPHP with bunch of tools for static code analysis Symfony Framework

196.7k](/packages/sci3ma-symfony-grumphp)[acquia/orca

A tool for testing a company's software packages together in the context of a realistic, functioning, best practices Drupal build

32902.4k](/packages/acquia-orca)[youwe/testing-suite

Contains Youwe's default testing packages for php.

13176.9k8](/packages/youwe-testing-suite)

PHPackages © 2026

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