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

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

sympress/coding-standards
=========================

Enterprise PHP coding standards for WordPress and Symfony-inspired development.

1.1.0(1mo ago)1302GPL-2.0-or-laterPHPPHP ^8.5CI passing

Since Jun 10Pushed 1w agoCompare

[ Source](https://github.com/SymPress/coding-standards)[ Packagist](https://packagist.org/packages/sympress/coding-standards)[ RSS](/packages/sympress-coding-standards/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (13)Versions (4)Used By (0)

SymPress Coding Standards
=========================

[](#sympress-coding-standards)

[![Checks](https://camo.githubusercontent.com/e14469511000499adb968a36e5c3af4121a881e0b2f6f3a30beef709167b0002/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f53796d50726573732f636f64696e672d7374616e64617264732f71612e796d6c3f6272616e63683d6d61696e266c6162656c3d636865636b73)](https://github.com/SymPress/coding-standards/actions/workflows/qa.yml) [![Release](https://camo.githubusercontent.com/832faf1071eb1ecf3d377ace8e4216098ff092705767e6d9947614889be308ed/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f53796d50726573732f636f64696e672d7374616e64617264733f6c6162656c3d72656c65617365)](https://github.com/SymPress/coding-standards/releases) [![PHP](https://camo.githubusercontent.com/f99871ccb88a558394c675f6c3621441edfcb4681eb03fa6b5fb397ca02a73ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f73796d70726573732f636f64696e672d7374616e64617264732f7068702e7376673f6c6162656c3d706870)](https://packagist.org/packages/sympress/coding-standards) [![Downloads](https://camo.githubusercontent.com/4e301a981326348a8cb8309f3f9752beca1b0ee3ed43319fa10f620d3bb15e7a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796d70726573732f636f64696e672d7374616e64617264732e7376673f6c6162656c3d646f776e6c6f616473)](https://packagist.org/packages/sympress/coding-standards/stats) [![License: GPL-2.0-or-later](https://camo.githubusercontent.com/26f8b6541ea045cc1dbc2267208158b5a7ebbf5cf437c4b486d80fee9386f77e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d2d322e302d2d6f722d2d6c617465722d626c75652e737667)](LICENSE)

> SymPress PHP coding standards for WordPress projects built with Symfony-level application structure.

SymPress Coding Standards is a PHP\_CodeSniffer ruleset package for modern WordPress projects. It combines custom SymPress sniffs with established PHPCS standards for PHP, WordPress, WordPress VIP, PHP compatibility, variable analysis, array normalization, and modern PHP practices.

The package is designed for projects that keep domain and application code framework-agnostic while isolating WordPress integration at explicit boundaries.

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
    - [Local Installation](#local-installation)
    - [Global Installation](#global-installation)
- [Verify Installation](#verify-installation)
- [Standards Basis](#standards-basis)
- [Rulesets](#rulesets)
- [Enterprise Profiles](#enterprise-profiles)
- [Usage](#usage)
    - [Command Line](#command-line)
    - [Custom Ruleset](#custom-ruleset)
    - [Customization](#customization)
    - [Auto-Fixing](#auto-fixing)
    - [Disabling or Excluding Rules](#disabling-or-excluding-rules)
    - [IDE Integration](#ide-integration)
- [Enterprise Documentation](#enterprise-documentation)
- [Development](#development)
- [Copyright and License](#copyright-and-license)

Requirements
------------

[](#requirements)

The SymPress Coding Standards package requires:

- PHP 8.5 or newer to run the standard
- Composer 2
- PHP\_CodeSniffer 3.13.5 or newer on the 3.x line
- PHPCompatibility 9.3 or 10
- PHPCSExtra
- PHPCSUtils
- Slevomat Coding Standard
- VariableAnalysis
- WordPress Coding Standards 3.1 or newer
- WordPress VIP Coding Standards

The enterprise profiles make the target PHP and WordPress support level explicit. Run PHP\_CodeSniffer on a PHP runtime that can tokenize the syntax used by the project being checked.

When installed for local development, this package also declares PHPUnit and PHPStan-related development dependencies.

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

[](#installation)

Installing this package with Composer installs the required PHPCS standards and registers them through the PHP\_CodeSniffer Standards Composer Installer plugin.

### Local Installation

[](#local-installation)

Install the package in a project:

```
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev sympress/coding-standards
```

### Global Installation

[](#global-installation)

The package can also be installed globally:

```
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer global require --dev sympress/coding-standards
```

### Verify Installation

[](#verify-installation)

Verify that PHP\_CodeSniffer discovered the standards:

```
vendor/bin/phpcs -i
```

The output should include the SymPress standards:

```
SymPress, SymPress-Boundary, SymPress-Core, SymPress-Enterprise-LTS, SymPress-Enterprise-Modern, SymPress-Enterprise-Next, SymPress-Extra, SymPress-Plugin, SymPress-Pure, SymPress-Templates, SymPress-WordPress

```

Standards Basis
---------------

[](#standards-basis)

SymPress Coding Standards is intentionally not a fully custom style dialect. It starts from official and widely adopted PHP\_CodeSniffer standards, then adds SymPress-specific rules where WordPress projects with a Symfony-style application structure need sharper boundaries.

The formatting baseline follows [PSR-12](https://www.php-fig.org/psr/psr-12/) and the PSR rules bundled with PHP\_CodeSniffer. Import layout follows the PSR-12 header model: class imports, function imports, and constant imports are separate blocks, with a single blank line between blocks.

The pure PHP layer also uses Slevomat Coding Standard for modern PHP practices. Fully qualified global function calls are normalized to explicit function imports. This keeps global function references explicit and compiler-friendly while avoiding leading backslashes throughout implementation code.

WordPress-facing profiles build on established WordPress ecosystem standards: WordPress Coding Standards, selected WordPress VIP checks, PHPCompatibility, PHPCSExtra, PHPCSUtils, and VariableAnalysis. SymPress rules sit on top of those foundations to express package boundaries, architecture preferences, and project-level migration posture.

Rulesets
--------

[](#rulesets)

This package contains these rulesets:

- `SymPress`: Complete set of custom sniffs defined by this package. Use it for cherry-picking specific SymPress rules.
- `SymPress-Pure`: Framework-agnostic PHP layer for domain, application, package, and infrastructure code.
- `SymPress-WordPress`: Extends `SymPress-Pure` with WordPress security, database, hook, i18n, compatibility, selected VIP checks, and WordPress i18n line-length exceptions. This layer does not pin a target PHP or WordPress version by itself.
- `SymPress-Boundary`: WordPress boundary layer for plugin files, theme functions, bootstrap scripts, and integration glue.
- `SymPress-Enterprise-LTS`: Conservative enterprise profile for WordPress 6.5+ migrations.
- `SymPress-Enterprise-Modern`: Recommended enterprise default for PHP 8.4+ and WordPress 7.0+ projects.
- `SymPress-Enterprise-Next`: Strict profile for new codebases on PHP 8.5+ and WordPress 7.0+.
- `SymPress-Plugin`: Compatibility name for `SymPress-Enterprise-Next`.
- `SymPress-Core`: Compatibility name for `SymPress-Enterprise-Next`.
- `SymPress-Extra`: Compatibility name for `SymPress-Enterprise-Next`.
- `SymPress-Templates`: WordPress security layer plus additional rules for PHP template files.

The `SymPress-Pure` layer is intentionally free of WordPress globals. Use `SymPress-Boundary` only where WordPress requires procedural entrypoints or direct integration code.

WordPress-specific allowances stay outside the pure layer. For example, `SymPress-WordPress`configures `SymPress.Files.LineLength` to tolerate long literal strings passed to WordPress i18n functions, while `SymPress-Pure` keeps the line-length rule framework-neutral.

Base layers such as `SymPress-Pure`, `SymPress-WordPress`, `SymPress-Boundary`, and `SymPress-Templates` are version-neutral. Use an enterprise profile or project-level `testVersion` and `minimum_wp_version` settings to define compatibility.

Enterprise Profiles
-------------------

[](#enterprise-profiles)

New enterprise projects should choose an explicit compatibility profile:

ProfileUse whenTarget`SymPress-Enterprise-LTS`A large legacy codebase needs conservative rollout and warning-first architecture rules.WordPress 6.5+`SymPress-Enterprise-Modern`A current enterprise project wants strict security and correctness without forcing every style preference immediately.PHP 8.4+, WordPress 7.0+`SymPress-Enterprise-Next`A new package or greenfield project intentionally tracks the newest supported stack.PHP 8.5+, WordPress 7.0+See [docs/Compatibility.md](docs/Compatibility.md), [docs/Adoption.md](docs/Adoption.md), and [docs/Rules.md](docs/Rules.md) for the full strategy.

Usage
-----

[](#usage)

### Command Line

[](#command-line)

Run PHP\_CodeSniffer with a standard directly:

```
vendor/bin/phpcs --standard=SymPress-Plugin ./packages/my-plugin/src
```

Run the recommended enterprise default:

```
vendor/bin/phpcs --standard=SymPress-Enterprise-Modern ./packages/my-plugin/src
```

Run only the framework-agnostic layer:

```
vendor/bin/phpcs --standard=SymPress-Pure ./packages/my-library/src
```

Run template rules for a specific file. Prefer a project ruleset so the compatibility target is explicit:

```
vendor/bin/phpcs --standard=phpcs.xml.dist ./packages/my-theme/views/page.php
```

Use `-s` to display sniff codes:

```
vendor/bin/phpcs -s --standard=SymPress-Plugin ./packages/my-plugin/src
```

### Custom Ruleset

[](#custom-ruleset)

Like any PHP\_CodeSniffer standard, SymPress can be referenced from a `phpcs.xml.dist` file.

A minimal configuration:

```

    src
    tests

```

A fuller project configuration with boundary and template layers:

```

    Project coding standard for an enterprise SymPress package.

    src
    tests
    templates
    plugin.php

    vendor/*
    node_modules/*
    build/*

        */plugin.php
        */templates/*

        */plugin.php
        */functions.php
        */config/*

        */templates/*
        */views/*

        */tests/*

```

Using a default ruleset keeps command-line usage simple:

```
vendor/bin/phpcs
```

Any command-line option passed to `phpcs` overrides the matching value from the ruleset.

### Customization

[](#customization)

SymPress sniffs can be configured with PHPCS properties where the sniff exposes public configuration.

Example: change the maximum function length:

```

```

Example: change class and file length guardrails:

```

```

Example: configure PSR-4 checks:

```

```

Example: allow additional short variable or parameter names:

```

```

SymPress expects data accessors to use framework-friendly getter and setter names. Prefer:

```
public function getTitle(): string
{
    return $this->title;
}

public function setTitle(string $title): void
{
    $this->title = $title;
}
```

Instead of property-style reads or behavior-like names for direct data assignment:

```
public function title(): string
{
    return $this->title;
}

public function rename(string $title): void
{
    $this->title = $title;
}
```

The rule is exposed as `SymPress.Classes.AccessorNaming`. For concrete methods, it reports only simple direct accessors such as `return $this->title;` or `$this->title = $title;` with no additional statements. For abstract/interface signatures without a body, it falls back to property-like read names and setter-like command prefixes. Boolean reads may use predicate getter names such as `isActive()` and `hasChildren()`. PHP property hooks using `get` and `set` blocks are supported and are treated as property syntax, not method accessor violations.

SymPress also reports redundant temporary variables that are assigned only to be used by a following `return`, `throw`, `echo`, `print`, or `yield` statement. Prefer:

```
return (array) json_decode($json, true, 512, JSON_THROW_ON_ERROR);
```

Instead of:

```
$decoded = json_decode($json, true, 512, JSON_THROW_ON_ERROR);

return (array) $decoded;
```

The rule is exposed as `SymPress.Variables.RedundantAssignment` and complements `SlevomatCodingStandard.Variables.UselessVariable`. It is intentionally aggressive: it also reports assignments made before unrelated business code and assignments whose right-hand side is a method or function call when the assigned variable is only used by the final statement.

```
$foo = $this->buildValue();

$prefix = strtoupper('Result');

return sprintf('%s', $foo);
```

See [docs/Sniffs.md](docs/Sniffs.md) for the custom SymPress sniff list.

### Auto-Fixing

[](#auto-fixing)

Some rules can be fixed automatically with PHP\_CodeSniffer's fixer:

```
vendor/bin/phpcbf --standard=SymPress-Enterprise-Modern ./packages/my-plugin/src
```

Custom fixer output is covered by regression tests. Use automatic fixing deliberately and review the diff afterwards.

### Disabling or Excluding Rules

[](#disabling-or-excluding-rules)

Prefer ruleset-level exclusions over inline comments. This keeps intentional deviations visible in review.

Disable a rule for the whole project:

```

```

Disable a rule for a path:

```

    */tests/*

```

Use inline ignores only for narrow, local exceptions:

```
// phpcs:ignore SymPress.Functions.DisallowCallUserFunc.Found
call_user_func($callback);
```

More examples are available in [docs/Disabling.md](docs/Disabling.md).

### IDE Integration

[](#ide-integration)

For PhpStorm, configure PHP\_CodeSniffer under:

```
Settings -> PHP -> Quality Tools -> PHP_CodeSniffer

```

Point the tool to `vendor/bin/phpcs`, validate the path, then enable:

```
Editor -> Inspections -> PHP -> Quality Tools -> PHP_CodeSniffer validation

```

Refresh the coding standard list and select `SymPress-Enterprise-Modern`, `SymPress-Plugin`, `SymPress-Pure`, or a project-specific `phpcs.xml.dist` file.

Enterprise Documentation
------------------------

[](#enterprise-documentation)

- [Compatibility](docs/Compatibility.md) describes PHP, WordPress, VIP, PHPCompatibility, and PHPCS 4 posture.
- [Enterprise Adoption](docs/Adoption.md) describes baseline, strict-new-code-only, legacy-boundary, and full-strict rollout modes.
- [Rule Strategy](docs/Rules.md) defines severity classes and the custom sniff catalog.
- [Release and Trust Policy](docs/Release.md) defines SemVer, changelog expectations, CI matrix, and benchmark protocol.

SymPress uses the global [`SymPress/.github`](https://github.com/SymPress/.github/) repository for organization-wide contributing, security, code of conduct, issue, and pull request defaults. This package adds local docs only where the coding standard needs package-specific policy.

Development
-----------

[](#development)

Run the package coding standard:

```
composer cs
```

Run PHPUnit:

```
composer tests
```

Run PHPUnit with coverage reports when Xdebug or PCOV is available:

```
composer tests:coverage
```

Run the full QA script:

```
composer qa
```

Copyright and License
---------------------

[](#copyright-and-license)

This package is distributed under GPL-2.0-or-later. It contains modified GPL-licensed work from the Syde PHP Coding Standards project. See [NOTICE.md](NOTICE.md) and [LICENSE](LICENSE).

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance95

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

Every ~4 days

Total

3

Last Release

37d ago

PHP version history (3 changes)1.0.0PHP &gt;=8.2 &lt;9.0

1.0.1PHP &gt;=8.4 &lt;9.0

1.1.0PHP ^8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/53712359?v=4)[Brian Schäffner](/maintainers/brianvarskonst)[@brianvarskonst](https://github.com/brianvarskonst)

---

Top Contributors

[![brianvarskonst](https://avatars.githubusercontent.com/u/53712359?v=4)](https://github.com/brianvarskonst "brianvarskonst (32 commits)")

---

Tags

code-stylecoding-standardphpphpcodesnifferphpcodesniffer-standardphpcsphpcs-standardsymfonywordpressphpcswordpressstatic analysiscoding-standardsSymPress

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[wp-cli/wp-cli-tests

WP-CLI testing framework

423.1M143](/packages/wp-cli-wp-cli-tests)[humanmade/coding-standards

Human Made Coding Standards

160443.1k60](/packages/humanmade-coding-standards)[yoast/yoastcs

PHP\_CodeSniffer rules for Yoast projects

221.2M34](/packages/yoast-yoastcs)[syde/phpcs

Syde PHP coding standards for WordPress projects.

1027.6k9](/packages/syde-phpcs)[drupal/coder

Coder is a library to review Drupal code.

3045.9M584](/packages/drupal-coder)[automattic/vipwpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress VIP minimum coding conventions

25811.4M205](/packages/automattic-vipwpcs)

PHPackages © 2026

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