PHPackages                             shopsys/coding-standards - 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. shopsys/coding-standards

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

shopsys/coding-standards
========================

Coding standards definition compatible with PSR-2

v19.0.0(1mo ago)20280.7k↓34%815MITPHPPHP ^8.5CI passing

Since Dec 18Pushed 5d ago9 watchersCompare

[ Source](https://github.com/shopsys/coding-standards)[ Packagist](https://packagist.org/packages/shopsys/coding-standards)[ RSS](/packages/shopsys-coding-standards/feed)WikiDiscussions 20.0 Synced 3d ago

READMEChangelogDependencies (20)Versions (234)Used By (15)

Shopsys Coding Standards
========================

[](#shopsys-coding-standards)

[![Downloads](https://camo.githubusercontent.com/5bd1a40f9e23532998ac32d8bc9a63a346b1787060d5d71988f391c4d6fed5e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73686f707379732f636f64696e672d7374616e64617264732e737667)](https://packagist.org/packages/shopsys/coding-standards)

Shopsys Coding Standards are based on [PSR-2](http://www.php-fig.org/psr/psr-2/).

This project bundles tools along with predefined rulesets for automated checks of Shopsys Coding Standards that we use in many Shopsys projects. The repository also contains [few custom rules](#custom-rules).

This repository is maintained by shopsys/shopsys monorepo, information about changes is in its `CHANGELOG` file.

Provided tools:

- [PHP-Parallel-Lint](https://github.com/JakubOnderka/PHP-Parallel-Lint)
- [EasyCodingStandard](https://github.com/Symplify/EasyCodingStandard) that combines [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) and [PHP\_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer)

For further information see official documentation of those tools.

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

[](#installation)

```
php composer require shopsys/coding-standards
```

Usage
-----

[](#usage)

Create `ecs.php` config file in your project which includes predefined ruleset. You can take [the config from the project-base](https://github.com/shopsys/shopsys/blob/HEAD/project-base/app/ecs.php) repository as an inspiration. You can also customize the rules and even add your own sniffs and fixers in the config.

In terminal, run following commands:

```
php vendor/bin/parallel-lint /path/to/project
php vendor/bin/ecs check /path/to/project --config=/path/to/project/custom-coding-standard.yml
```

Custom rules
------------

[](#custom-rules)

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

[](#rules-for-php-cs-fixer)

#### `Shopsys/missing_button_type`

[](#shopsysmissing_button_type)

All `` HTML tags in `.html` and `.html.twig` files must have explicit `type` attribute.

If the `type` is not specified it will be fixed to `type="button""` because the implicit value is `submit` which makes it behave differently based on the context (`` inside `` element submits the form).

#### `Shopsys/orm_join_column_require_nullable`

[](#shopsysorm_join_column_require_nullable)

Doctrine attributes `#[ORM\ManyToOne]` and `#[ORM\OneToOne]` must have `nullable` option defined explicitly in `#[ORM\JoinColumn]`.

If the `nullable` option is not specified it will be fixed to `nullable: false` because the implicit value is `true` but this is the opposite to the implicit value of `nullable` for `#[ORM\Column]` attribute. This makes it consistent.

### Rules for [PHP\_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer)

[](#rules-for-php_codesniffer)

#### `ForbiddenExitSniff`

[](#forbiddenexitsniff)

Function `exit()` is not allowed.

#### `ForbiddenSuperGlobalSniff`

[](#forbiddensuperglobalsniff)

Usage of superglobals (`$_COOKIE`, `$_GET`, `$_FILES`, `$_POST`, `$_REQUEST`, `$_SERVER`) is not allowed.

#### `ObjectIsCreatedByFactorySniff`

[](#objectiscreatedbyfactorysniff)

Instantiation of objects that can be created by their factories is not allowed outside of the factory.

#### `ValidVariableNameSniff`

[](#validvariablenamesniff)

Default `\PHP_CodeSniffer\Standards\Squiz\Sniffs\NamingConventions\ValidVariableNameSniff`does not report method parameters in `$_var` format as an violation but it should. It also skips checking of private members when `PrivateNoUnderscore` property is disabled.

This sniff provides the missing functionality and is intended to be used as an addition to the default `ValidVariableNameSniff`.

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

[](#contributing)

Thank you for your contributions to Shopsys Coding Standards package. Together we are making Shopsys Platform better.

This repository is READ-ONLY. If you want to [report issues](https://github.com/shopsys/shopsys/issues/new) and/or send [pull requests](https://github.com/shopsys/shopsys/compare), please use the main [Shopsys repository](https://github.com/shopsys/shopsys).

Please check our [Contribution Guide](https://github.com/shopsys/shopsys/blob/HEAD/CONTRIBUTING.md) before contributing.

Support
-------

[](#support)

What to do when you are in troubles or need some help? The best way is to join our [Slack](https://join.slack.com/t/shopsysframework/shared_invite/zt-11wx9au4g-e5pXei73UJydHRQ7nVApAQ).

If you want to [report issues](https://github.com/shopsys/shopsys/issues/new), please use the main [Shopsys repository](https://github.com/shopsys/shopsys).

###  Health Score

73

—

ExcellentBetter than 100% of packages

Maintenance96

Actively maintained with recent releases

Popularity45

Moderate usage in the ecosystem

Community38

Small or concentrated contributor base

Maturity100

Battle-tested with a long release history

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

Recently: every ~29 days

Total

96

Last Release

37d ago

Major Versions

15.0.x-dev → v16.0.02024-12-30

0.0.x-dev → 17.0.x-dev2025-09-10

v14.5.0 → 18.0.x-dev2025-12-29

v14.5.1 → v19.0.02026-05-26

v19.0.0 → 20.0.x-dev2026-05-28

PHP version history (6 changes)v4.0PHP ^7.1

v8.0.0PHP ^7.2

v10.0.0PHP ^8.0 || ^8.1

v12.0.0PHP ^8.1

v14.0.0PHP ^8.3

v19.0.0PHP ^8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5638367?v=4)[Tomáš Ludvik](/maintainers/TomasLudvik)[@TomasLudvik](https://github.com/TomasLudvik)

![](https://avatars.githubusercontent.com/u/1177414?v=4)[Martin Grossmann](/maintainers/grossmannmartin)[@grossmannmartin](https://github.com/grossmannmartin)

![](https://www.gravatar.com/avatar/8aee0045853dd983a2a4f291d2e21e7492e2d8c19d84cdb7a76dd16c3eb499f9?d=identicon)[rostislav.vitek@shopsys.com](/maintainers/rostislav.vitek@shopsys.com)

![](https://www.gravatar.com/avatar/0a44b48b2c3e7114fdf1cbdf9170494591abad48f5fc416d93b134abd771635f?d=identicon)[Miroslav Stopka](/maintainers/Miroslav%20Stopka)

---

Top Contributors

[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (108 commits)")[![vitek-rostislav](https://avatars.githubusercontent.com/u/10401898?v=4)](https://github.com/vitek-rostislav "vitek-rostislav (91 commits)")[![grossmannmartin](https://avatars.githubusercontent.com/u/1177414?v=4)](https://github.com/grossmannmartin "grossmannmartin (83 commits)")[![TomasLudvik](https://avatars.githubusercontent.com/u/5638367?v=4)](https://github.com/TomasLudvik "TomasLudvik (81 commits)")[![PetrHeinz](https://avatars.githubusercontent.com/u/10008612?v=4)](https://github.com/PetrHeinz "PetrHeinz (43 commits)")[![sustmi](https://avatars.githubusercontent.com/u/885946?v=4)](https://github.com/sustmi "sustmi (14 commits)")[![henzigo](https://avatars.githubusercontent.com/u/1482966?v=4)](https://github.com/henzigo "henzigo (12 commits)")[![pesektomas](https://avatars.githubusercontent.com/u/1737966?v=4)](https://github.com/pesektomas "pesektomas (12 commits)")[![RobinDvorak](https://avatars.githubusercontent.com/u/7197178?v=4)](https://github.com/RobinDvorak "RobinDvorak (7 commits)")[![boris-brtan](https://avatars.githubusercontent.com/u/39240194?v=4)](https://github.com/boris-brtan "boris-brtan (6 commits)")[![miroslav2stopka](https://avatars.githubusercontent.com/u/35224208?v=4)](https://github.com/miroslav2stopka "miroslav2stopka (6 commits)")[![s3tezsky](https://avatars.githubusercontent.com/u/53976269?v=4)](https://github.com/s3tezsky "s3tezsky (5 commits)")[![spagr](https://avatars.githubusercontent.com/u/6697111?v=4)](https://github.com/spagr "spagr (2 commits)")[![LukasHeinz](https://avatars.githubusercontent.com/u/33071107?v=4)](https://github.com/LukasHeinz "LukasHeinz (2 commits)")[![msshopsys](https://avatars.githubusercontent.com/u/128610012?v=4)](https://github.com/msshopsys "msshopsys (1 commits)")[![Miroslav-Stopka](https://avatars.githubusercontent.com/u/35930284?v=4)](https://github.com/Miroslav-Stopka "Miroslav-Stopka (1 commits)")[![machicek](https://avatars.githubusercontent.com/u/51356535?v=4)](https://github.com/machicek "machicek (1 commits)")[![sspooky13](https://avatars.githubusercontent.com/u/25614491?v=4)](https://github.com/sspooky13 "sspooky13 (1 commits)")[![rodrigoprimo](https://avatars.githubusercontent.com/u/77215?v=4)](https://github.com/rodrigoprimo "rodrigoprimo (1 commits)")[![pk16011990](https://avatars.githubusercontent.com/u/5857836?v=4)](https://github.com/pk16011990 "pk16011990 (1 commits)")

---

Tags

Code stylecode qualityPSR-2coding-standards

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/shopsys-coding-standards/health.svg)

```
[![Health](https://phpackages.com/badges/shopsys-coding-standards/health.svg)](https://phpackages.com/packages/shopsys-coding-standards)
```

###  Alternatives

[nunomaduro/phpinsights

Instant PHP quality checks from your console.

5.6k11.7M498](/packages/nunomaduro-phpinsights)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136406.3k14](/packages/rector-rector-src)[wp-cli/wp-cli-tests

WP-CLI testing framework

423.1M142](/packages/wp-cli-wp-cli-tests)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2603.2M436](/packages/ssch-typo3-rector)[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

40252.8k34](/packages/ec-europa-toolkit)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)

PHPackages © 2026

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