PHPackages                             flyeralarm/php-code-validator - 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. flyeralarm/php-code-validator

ActivePhpcodesniffer-standard[Utility &amp; Helpers](/categories/utility)

flyeralarm/php-code-validator
=============================

A custom coding standard for FLYERALARM

4.2.1(2mo ago)2226.9k↓20%156BSD-3-ClausePHPCI passing

Since Sep 5Pushed 2mo ago7 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (23)Used By (6)

FLYERALARM PHP Coding Guideline Validator
=========================================

[](#flyeralarm-php-coding-guideline-validator)

This repository contains the ruleset for the PHP code we develop at [FLYERALARM](https://flyeralarm.com). It mostly consists of PSR-12 with some custom additions. The rules are enforced with the help of PHPCSStandards/PHP\_CodeSniffer

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt).

Custom Rules in addition to PSR-12
----------------------------------

[](#custom-rules-in-addition-to-psr-12)

- Variable names MUST be in lowerCamelCase
- Yoda conditions MUST NOT be used
- Unit tests with @expectedException MUST contain @expectedExceptionMessage annotation
- Exceptions messages MUST not contain exclamation marks or full stops
- Keywords GOTO and EVAL MUST NOT be used
- Underscores in namespaces MUST NOT be used
- Classtype suffixes like Interface, Abstract or Trait MUST NOT be used (e.g. LoggerInterface)

How-To work within *this* project
---------------------------------

[](#how-to-work-within-this-project)

To prepare run command:

```
make build
make install
```

To check code style compliance or to fix what can be autofixed run commands:

```
make sniff
make sniff-fix
```

To test ruleset run command:

```
make test
```

As test runner is dockerized we can test with different PHP versions:

```
PHP_VERSION=8.2 make test
```

or all at once:

```
make test-all
```

Embed into *your* project
-------------------------

[](#embed-into-your-project)

Add as composer dev dependency:

```
composer require --dev flyeralarm/php-code-validator

```

Embed code sniffer in your Makefile. To intend please use tabs instead of spaces.

Example Makefile:

```
test:
	vendor/bin/phpcs -w -p -s --standard=vendor/flyeralarm/php-code-validator/ruleset.xml src/ tests/
```

### Add project specific rules

[](#add-project-specific-rules)

The recommended way to define custom rules for the own project is to provide a `phpcs.xml` in the root of your project. PHP\_CodeSniffer will automatically detect this standard if no other standard was defined (See [PHP\_CodeSniffer Advanced Usage](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file)).

This `phpcs.xml` can then reference the FLYERALARM PHP coding standard.

```

    ./src/
    ./tests/

```

Once the file `phpcs.xml` is created the code can be validated using:

```
vendor/bin/phpcs
```

### Update to latest stable

[](#update-to-latest-stable)

```
composer update flyeralarm/php-code-validator
```

### Run sniffer

[](#run-sniffer)

```
make test
```

Use within PHPStorm
-------------------

[](#use-within-phpstorm)

1. Ensure the path to PHP Code Sniffer is configured - [open configuration manual](https://confluence.jetbrains.com/display/PhpStorm/PHP+Code+Sniffer+in+PhpStorm#PHPCodeSnifferinPhpStorm-1.1.SpecifyingthepathtoPHPCodeSniffer)
2. Open settings:
    Mac: `PhpStorm` &gt; `Preferences` &gt; `Editor` &gt; `Inspections` &gt; `PHP`
    Windows &amp; Linux: `File` &gt; `Settings` &gt; `Editor` &gt; `Inspections` &gt; `PHP` \\
3. Activate/Tick checkbox for `PHP Code Sniffer validation`
4. Click on the item `PHP Code Sniffer validation` to open its settings on the right hand side
5. Choose "Custom" for „Coding standard:“ and click on `...` on the right hand side
6. Select Path to ruleset. This would be something like &lt;YOUR\_APP\_ROOT&gt;/vendor/flyeralarm/php-code-validator/ruleset.xml
7. Confirm dialogs by pressing `ok`

On a side note: [We are searching for talented people to join our various teams of developers in multiple locations](https://www.flyeralarm.com/it-jobs/)

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance85

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community32

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~182 days

Recently: every ~239 days

Total

18

Last Release

75d ago

Major Versions

1.0.1 → 2.0.02017-09-29

2.3.0 → 3.0.02020-10-05

3.2.4 → 4.0.02023-07-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/3fa62a8c98b0d91e15c812c7a1c7a01b6e0180eeaac17c23c2c272a2898025bd?d=identicon)[MichelHartmann](/maintainers/MichelHartmann)

![](https://www.gravatar.com/avatar/8fdd1eba32c6a808e1063fecd3660502009f38f38ea7371d733eecce2be51c6b?d=identicon)[flyeralarm-esolutions](/maintainers/flyeralarm-esolutions)

---

Top Contributors

[![fa-grosch](https://avatars.githubusercontent.com/u/14111117?v=4)](https://github.com/fa-grosch "fa-grosch (34 commits)")[![daniel-mueller](https://avatars.githubusercontent.com/u/3153932?v=4)](https://github.com/daniel-mueller "daniel-mueller (17 commits)")[![MichelHartmann](https://avatars.githubusercontent.com/u/274451?v=4)](https://github.com/MichelHartmann "MichelHartmann (16 commits)")[![vladimir-flyeralarm](https://avatars.githubusercontent.com/u/206125479?v=4)](https://github.com/vladimir-flyeralarm "vladimir-flyeralarm (10 commits)")[![Macavity](https://avatars.githubusercontent.com/u/300609?v=4)](https://github.com/Macavity "Macavity (7 commits)")[![vukanac](https://avatars.githubusercontent.com/u/2384207?v=4)](https://github.com/vukanac "vukanac (4 commits)")[![fschmtt](https://avatars.githubusercontent.com/u/5806324?v=4)](https://github.com/fschmtt "fschmtt (4 commits)")[![HartmannS](https://avatars.githubusercontent.com/u/44034074?v=4)](https://github.com/HartmannS "HartmannS (3 commits)")[![fa-dis](https://avatars.githubusercontent.com/u/205787957?v=4)](https://github.com/fa-dis "fa-dis (3 commits)")[![max-grosch](https://avatars.githubusercontent.com/u/29977483?v=4)](https://github.com/max-grosch "max-grosch (3 commits)")[![seb-h-k](https://avatars.githubusercontent.com/u/1057865?v=4)](https://github.com/seb-h-k "seb-h-k (3 commits)")[![sven-fly](https://avatars.githubusercontent.com/u/238638066?v=4)](https://github.com/sven-fly "sven-fly (3 commits)")[![bgrande](https://avatars.githubusercontent.com/u/477572?v=4)](https://github.com/bgrande "bgrande (1 commits)")[![abrinsibl](https://avatars.githubusercontent.com/u/139882156?v=4)](https://github.com/abrinsibl "abrinsibl (1 commits)")[![tolik518](https://avatars.githubusercontent.com/u/3026792?v=4)](https://github.com/tolik518 "tolik518 (1 commits)")[![cmikle](https://avatars.githubusercontent.com/u/32614008?v=4)](https://github.com/cmikle "cmikle (1 commits)")[![Mirroar](https://avatars.githubusercontent.com/u/151859?v=4)](https://github.com/Mirroar "Mirroar (1 commits)")

### Embed Badge

![Health badge](/badges/flyeralarm-php-code-validator/health.svg)

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

PHPackages © 2026

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