PHPackages                             luc45/phpcs-ctrf-reporter - 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. luc45/phpcs-ctrf-reporter

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

luc45/phpcs-ctrf-reporter
=========================

CTRF (Common Test Report Format) reporter for PHP\_CodeSniffer.

00PHPCI passing

Since Apr 28Pushed 2mo agoCompare

[ Source](https://github.com/Luc45/phpcs-ctrf-reporter)[ Packagist](https://packagist.org/packages/luc45/phpcs-ctrf-reporter)[ RSS](/packages/luc45-phpcs-ctrf-reporter/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

phpcs-ctrf-reporter
===================

[](#phpcs-ctrf-reporter)

A [PHP\_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) reporter that emits results in the [Common Test Report Format (CTRF)](https://ctrf.io/) — an open JSON standard for test results consumed by GitHub Actions summaries, dashboards, and other CI tooling.

Why
---

[](#why)

PHPCS ships with JUnit XML output, but JUnit XML is older, has looser semantics, and isn't as well-supported by modern CI surfaces. CTRF is a tighter JSON schema that's validatable end-to-end (`ctrf-cli validate`) and feeds into the same reporting pipelines as test runs.

Install
-------

[](#install)

```
composer require --dev luc45/phpcs-ctrf-reporter
```

Usage
-----

[](#usage)

```
vendor/bin/phpcs --report='Luc45\PhpcsCtrf\Reports\Ctrf' src/
```

Or write to a file:

```
vendor/bin/phpcs --report-Luc45\\PhpcsCtrf\\Reports\\Ctrf=report.json src/
```

(Escape the backslashes in the report flag according to your shell.)

Mapping
-------

[](#mapping)

PHPCS findingCTRF test statusERROR violation`failed`WARNING violation`other`Clean file (no violations)`passed`PHPCS-native metadata (sniff source, severity, fixability, column) is preserved via CTRF's `rawStatus`, `tags`, and `extra` extension fields.

Example output
--------------

[](#example-output)

Given a fixture with one violation, the reporter emits:

```
{
    "reportFormat": "CTRF",
    "specVersion": "1.0.0",
    "reportId": "c236c666-f286-457f-82da-b5074eaec7ec",
    "timestamp": "2026-04-28T13:26:26Z",
    "generatedBy": "PHP_CodeSniffer 4.0.2",
    "results": {
        "tool": { "name": "PHP_CodeSniffer", "version": "4.0.2" },
        "summary": {
            "tests": 1, "passed": 0, "failed": 1,
            "skipped": 0, "pending": 0, "other": 0,
            "suites": 1,
            "start": 1777382786761, "stop": 1777382786761, "duration": 0,
            "extra": { "fixable": 1 }
        },
        "tests": [
            {
                "name": "Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine at example.php (7:34)",
                "status": "failed",
                "message": "Opening brace should be on a new line",
                "filePath": "example.php",
                "line": 7,
                "rawStatus": "ERROR",
                "type": "lint",
                "tags": ["ERROR", "fixable"],
                "extra": {
                    "column": 34,
                    "severity": 5,
                    "fixable": true,
                    "source": "Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"
                }
            }
        ]
    }
}
```

Validation
----------

[](#validation)

Output passes both `ctrf-cli validate` and the stricter `ctrf-cli validate-strict` (which enforces `additionalProperties: false`):

```
npx --package=ctrf-cli@latest -- ctrf-cli validate report.json
npx --package=ctrf-cli@latest -- ctrf-cli validate-strict report.json
```

Testing
-------

[](#testing)

CI runs the reporter through PHPCS's own test infrastructure: every commit clones the latest `4.x` branch of [PHPCSStandards/PHP\_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer), injects this package's reporter and tests via [`bin/inject-into-phpcs.sh`](bin/inject-into-phpcs.sh), and runs PHPCS's full PHPUnit + bashunit suite (4,000+ tests) against the modified tree on PHP 7.2 → 8.5.

This means the reporter is exercised in the exact harness it would face if merged into PHPCS itself, and any breaking change in PHPCS's API is caught the day it lands upstream — not when a user reports a bug.

To reproduce locally:

```
git clone https://github.com/PHPCSStandards/PHP_CodeSniffer.git phpcs
(cd phpcs && composer install)
./bin/inject-into-phpcs.sh phpcs
(cd phpcs && ./vendor/bin/phpunit)
```

Compatibility
-------------

[](#compatibility)

- Requires PHP 7.2+
- Requires PHP\_CodeSniffer 4.x

License
-------

[](#license)

BSD-3-Clause — see [LICENSE](LICENSE).

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance56

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/83326082?v=4)[Lucas Bustamante](/maintainers/lucasbustamante)[@lucasbustamante](https://github.com/lucasbustamante)

---

Top Contributors

[![Luc45](https://avatars.githubusercontent.com/u/9341686?v=4)](https://github.com/Luc45 "Luc45 (2 commits)")

### Embed Badge

![Health badge](/badges/luc45-phpcs-ctrf-reporter/health.svg)

```
[![Health](https://phpackages.com/badges/luc45-phpcs-ctrf-reporter/health.svg)](https://phpackages.com/packages/luc45-phpcs-ctrf-reporter)
```

PHPackages © 2026

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