PHPackages                             cn-consult/coding-standard - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cn-consult/coding-standard

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cn-consult/coding-standard
==========================

Our Company-Wide Coding Standard based on PHP\_CodeSniffer

0.7(6y ago)09.6k↓77.8%1[3 PRs](https://github.com/CN-Consult/coding-standard/pulls)MITPHPCI passing

Since Mar 10Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/CN-Consult/coding-standard)[ Packagist](https://packagist.org/packages/cn-consult/coding-standard)[ RSS](/packages/cn-consult-coding-standard/feed)WikiDiscussions master Synced 1w ago

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

CN-Consult CodingStandard
=========================

[](#cn-consult-codingstandard)

Our Company-Wide Coding Standard based on PHP\_CodeSniffer.

Currently this is targeted for PHP-Code only, but it may also be used to sniff JS-Code or CSS, but we have no special Sniffs or Code for these languages.

Usage
=====

[](#usage)

To use this repository, add it as dev-dependency to your `composer.json`: `composer require --dev cn-consult/coding-standard:dev-master`.

Aftewards create a file `phpcs.xml` in your project root and add the following contents:

```

    My cool project, using the CN-Consult PHPCS standard

    vendor/*

```

Afterwards you can check your code by executing: `vendor/bin/phpcs .`

Development
===========

[](#development)

To add new rules to our standard you should open up a youtrack-ticket and explain what you want to accomplish. You should add some examples that shows what the check should allow and/or disallow. When you get positive feedback you may implement your check. Before you implement a custom Sniff, it is a good idea to check if there perhaps already exists a Sniff that accomplishes what you want. Unfortunatly there is no single documentation that shows all available Sniffs. A good starting point may be [https://github.com/squizlabs/PHP\_CodeSniffer/wiki/Customisable-Sniff-Properties](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties) or having a look at the implemented Sniffs by name or searching after the required token in the sourcecode (for example T\_FUNCTION). If there is no other way you may implement your own sniff by following this guide: [https://github.com/squizlabs/PHP\_CodeSniffer/wiki/Coding-Standard-Tutorial](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standard-Tutorial)

After you added your sniff, you can run phpcs through the provided script in `tests/run-manually.sh` and check if it works and outputs the correct issues for test-files. If all is like expected please make sure that your new sniff is tested properly.

How to add new good tests
-------------------------

[](#how-to-add-new-good-tests)

This is really easy. Just add additional files in the `examples/good/` directory that you don't expect to generate any output, and run the unit-tests. Your new files will be picked up automatically.

How to add new bad tests
------------------------

[](#how-to-add-new-bad-tests)

This is a bit more involved. First add an example file in the `examples/bad/` directory that should trigger some issue. The use the `tests/generate-expected-bad-output.php` to verify that the file shows the issues you expect and create an accompanying expected-file. The `generate-expected-bad-output.php` will guide you through this process, just read its output.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance61

Regular maintenance activity

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2261d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1b235747c088b9483088295988e707651792a6c5b51c1723d22018d683ffca16?d=identicon)[Shyru](/maintainers/Shyru)

---

Top Contributors

[![Shyru](https://avatars.githubusercontent.com/u/957556?v=4)](https://github.com/Shyru "Shyru (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cn-consult-coding-standard/health.svg)

```
[![Health](https://phpackages.com/badges/cn-consult-coding-standard/health.svg)](https://phpackages.com/packages/cn-consult-coding-standard)
```

###  Alternatives

[shopsys/coding-standards

Coding standards definition compatible with PSR-2

20269.1k13](/packages/shopsys-coding-standards)[flyeralarm/php-code-validator

A custom coding standard for FLYERALARM

2226.9k6](/packages/flyeralarm-php-code-validator)

PHPackages © 2026

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