PHPackages                             valkyrja/phpcodesniffer - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. valkyrja/phpcodesniffer

ActiveProject[DevOps &amp; Deployment](/categories/devops)

valkyrja/phpcodesniffer
=======================

PHPCodeSniffer for the Valkyrja Project.

v26.1.2(1mo ago)01.7k—1.8%MITPHPPHP &gt;=8.4CI passing

Since Apr 16Pushed 1w agoCompare

[ Source](https://github.com/valkyrjaio/ci-phpcodesniffer-php)[ Packagist](https://packagist.org/packages/valkyrja/phpcodesniffer)[ Docs](https://www.valkyrja.io/)[ RSS](/packages/valkyrja-phpcodesniffer/feed)WikiDiscussions 26.x Synced 1w ago

READMEChangelog (5)Dependencies (2)Versions (17)Used By (0)

[ ![](https://raw.githubusercontent.com/valkyrjaio/art/refs/heads/master/long-banner/orange/php.png)](https://valkyrja.io)

Valkyrja PHP Code Sniffer
=========================

[](#valkyrja-php-code-sniffer)

Shared PHP Code Sniffer configuration for Valkyrja PHP projects — ruleset and reusable workflow that enforce the project's file-naming and namespace conventions across consuming repositories.

 [![PHP Version Require](https://camo.githubusercontent.com/8afea147b8590064a292c4b492f898aa8066bbbb0d9680084657a3a8319c19e7/68747470733a2f2f706f7365722e707567782e6f72672f76616c6b79726a612f706870636f6465736e69666665722f726571756972652f706870)](https://packagist.org/packages/valkyrja/phpcodesniffer) [![Latest Stable Version](https://camo.githubusercontent.com/59c6a88f20cc957451a91ed5b0455ab0a713c7a89c1ed116bc5f6b103d718184/68747470733a2f2f706f7365722e707567782e6f72672f76616c6b79726a612f706870636f6465736e69666665722f76)](https://packagist.org/packages/valkyrja/phpcodesniffer) [![License](https://camo.githubusercontent.com/93d3224bf4f60c87e83fa98f7dd952f416f897edcdfe8d06d0814af463d67af1/68747470733a2f2f706f7365722e707567782e6f72672f76616c6b79726a612f706870636f6465736e69666665722f6c6963656e7365)](https://packagist.org/packages/valkyrja/phpcodesniffer) [![CI Status](https://github.com/valkyrjaio/ci-phpcodesniffer-php/actions/workflows/ci.yml/badge.svg?branch=26.x)](https://github.com/valkyrjaio/ci-phpcodesniffer-php/actions/workflows/ci.yml?query=branch%3A26.x) [![Scrutinizer](https://camo.githubusercontent.com/35fa7a0702c608495a2d90506b37e38a0bfa079603c348d96717f990a341bd79/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f76616c6b79726a61696f2f63692d706870636f6465736e69666665722d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d32362e78)](https://scrutinizer-ci.com/g/valkyrjaio/ci-phpcodesniffer-php/?branch=26.x) [![Coverage Status](https://camo.githubusercontent.com/16024cb7693a1ff2789a7e049d5c52cae17622ce4154d2e89516a3d7f41e9d02/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f76616c6b79726a61696f2f63692d706870636f6465736e69666665722d7068702f62616467652e7376673f6272616e63683d32362e78)](https://coveralls.io/github/valkyrjaio/ci-phpcodesniffer-php?branch=26.x) [![Psalm Shepherd](https://camo.githubusercontent.com/7848230cc46bb02dd3acb1a9ee47e15771948a4b1d5342d6bb859480b64247e5/68747470733a2f2f73686570686572642e6465762f6769746875622f76616c6b79726a61696f2f63692d706870636f6465736e69666665722d7068702f636f7665726167652e737667)](https://shepherd.dev/github/valkyrjaio/ci-phpcodesniffer-php) [![Maintainability Rating](https://camo.githubusercontent.com/1797b950296f1d1d09e7be4f530096267b838c143eb51467246422fb08c3146a/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d76616c6b79726a61696f5f706870636f6465736e6966666572266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/summary/new_code?id=valkyrjaio_phpcodesniffer)

Usage
-----

[](#usage)

The ruleset is defined in `.github/ci/phpcodesniffer/ruleset.xml` and run via the `phpcodesniffer` Composer script:

```
composer phpcodesniffer

```

This runs `phpcs` against `src/` and `tests/` using the project ruleset. The `src/` run suppresses warnings (`-n`); the `tests/` run additionally shows sniff source codes (`-n -s`).

To see all warnings (not just errors), run:

```
cd .github/ci/phpcodesniffer && composer warnings

```

Ruleset
-------

[](#ruleset)

### Excluded Paths

[](#excluded-paths)

The following paths are excluded from all checks:

Path`.github/``.phpunit.cache/``build/``coverage-html/``docs/``functions/``pre-commit-hooks/``vendor/`### Rules

[](#rules)

#### `SlevomatCodingStandard.Files.TypeNameMatchesFileName`

[](#slevomatcodingstandardfilestypenamematchesfilename)

Enforces that each type (class, interface, trait, enum) is declared in a file whose name matches the type name, rooted at the configured namespaces:

Root pathNamespace`src/Valkyrja``Valkyrja``tests/Tests``Valkyrja\Tests`The following directories are skipped when resolving file paths:

`.github`, `docs`, `functions`, `pre-commit-hooks`, `vendor`

#### `SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly`

[](#slevomatcodingstandardnamespacesreferenceusednamesonly)

All referenced names must appear in `use` statements — fully qualified names are not permitted inline:

PropertyValueEffect`allowPartialUses``false`Partial uses (e.g. `use Foo\Bar` referencing `Bar\Baz`) are not allowed`allowFullyQualifiedNameForCollidingClasses``false`Colliding class names must be aliased, not referenced fully qualified`searchAnnotations``true`Annotations in docblocks are also checked for unimported namesWorkflows
---------

[](#workflows)

The [`_workflow-call.yml`](.github/workflows/_workflow-call.yml) reusable workflow runs PHP Code Sniffer against the calling repository's source. It is designed to be called from other repositories via `workflow_call`.

### Inputs

[](#inputs)

InputTypeDefaultDescription`paths`string—**Required.** YAML filter spec with two keys: `ci` (CI config files that trigger a base-branch fetch) and `files` (all files that trigger the check).`post-pr-comment`boolean`true`Post a PR comment on failure and remove it on success. Disable when the calling workflow handles its own reporting.`composer-options`string`''`Extra flags passed to every `composer install` step (e.g. `--ignore-platform-req=ext-openswoole`).`php-version`string`'8.4'`PHP version to use.`ci-directory`string`'.github/ci/phpcodesniffer'`Path to the CI directory containing `composer.json` and the tool config.`extensions`string`'mbstring, intl'`PHP extensions to install via `shivammathur/setup-php`.### Usage

[](#usage-1)

```
jobs:
  phpcodesniffer:
    uses: valkyrjaio/ci-phpcodesniffer-php/.github/workflows/_workflow-call.yml@26.x
    permissions:
      pull-requests: write
      contents: read
    with:
      php-version: '8.4'
      paths: |
        ci:
          - '.github/ci/phpcodesniffer/**'
          - '.github/workflows/phpcodesniffer.yml'
        files:
          - '.github/ci/phpcodesniffer/**'
          - '.github/workflows/phpcodesniffer.yml'
          - 'src/**/*.php'
          - 'composer.json'
    secrets: inherit
```

`secrets: inherit` is required to pass the `VALKYRJA_GHA_APP_ID` and `VALKYRJA_GHA_PRIVATE_KEY` org secrets used for PR comments.

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

[](#contributing)

See [`CONTRIBUTING.md`](https://github.com/valkyrjaio/.github/blob/master/CONTRIBUTING.md) for the submission process and [`VOCABULARY.md`](https://github.com/valkyrjaio/.github/blob/master/VOCABULARY.md) for the terminology used across Valkyrja.

Security Issues
---------------

[](#security-issues)

If you discover a security vulnerability, please follow our [disclosure procedure](https://github.com/valkyrjaio/.github/blob/master/SECURITY.md).

License
-------

[](#license)

Licensed under the [MIT license](https://opensource.org/licenses/MIT). See [`LICENSE.md`](./LICENSE.md).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance96

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.7% 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 ~9 days

Total

6

Last Release

9d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbb43a59fb790365b014e53f82e3f26893867e4a47a249fc92962b6dc76878f2?d=identicon)[MelechMizrachi](/maintainers/MelechMizrachi)

---

Top Contributors

[![MelechMizrachi](https://avatars.githubusercontent.com/u/1179171?v=4)](https://github.com/MelechMizrachi "MelechMizrachi (48 commits)")[![valkyrja-volundr[bot]](https://avatars.githubusercontent.com/in/2462900?v=4)](https://github.com/valkyrja-volundr[bot] "valkyrja-volundr[bot] (43 commits)")

---

Tags

PHPCodeSniffercivalkyrja

### Embed Badge

![Health badge](/badges/valkyrja-phpcodesniffer/health.svg)

```
[![Health](https://phpackages.com/badges/valkyrja-phpcodesniffer/health.svg)](https://phpackages.com/packages/valkyrja-phpcodesniffer)
```

###  Alternatives

[saggre/phpdocumentor-markdown

Markdown template for phpDocumentor3

2293.1k41](/packages/saggre-phpdocumentor-markdown)

PHPackages © 2026

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