PHPackages                             wptechnix/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. [Testing &amp; Quality](/categories/testing)
4. /
5. wptechnix/coding-standards

ActivePhpcodesniffer-standard[Testing &amp; Quality](/categories/testing)

wptechnix/coding-standards
==========================

A modern PHP coding standard (PHPCS) compatible with PSR-12, featuring additional rules for strictness and type safety.

v2.1.2(4mo ago)1173[1 PRs](https://github.com/WPTechnix/coding-standards/pulls)2MITPHP ^8.0CI passing

Since Nov 17Pushed 1mo agoCompare

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

READMEChangelog (10)Dependencies (3)Versions (13)Used By (2)

WPTechnix Coding Standards
==========================

[](#wptechnix-coding-standards)

 **PHP 8.0+ coding standards enforcing strict types, immutability, and PSR-12 compliance.**

 [![Source Code](https://camo.githubusercontent.com/3f4ea05c4b66877c0958f00e26df102c7692d781f67806da2a8fcb75035c811d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d7770746563686e69782f636f64696e672d2d7374616e64617264732d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/wptechnix/coding-standards) [![Download Package](https://camo.githubusercontent.com/fd6eef193688cf43a4577fa783b4d497b1d87094ec3003e5237f83503a21a8e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7770746563686e69782f636f64696e672d7374616e64617264732e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://packagist.org/packages/wptechnix/coding-standards) [![PHP Programming Language](https://camo.githubusercontent.com/998e695ce088a13ad7964c2cab3381b2acb19c2fe5bcd4a71bbde2cc3b2c4e62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7770746563686e69782f636f64696e672d7374616e64617264732e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d253233383839324246)](https://php.net) [![Read License](https://camo.githubusercontent.com/892e468eb519ef0d375cf75fd29c4fbe1fea1ccdd45d766cdbfc25554852dd03/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7770746563686e69782f636f64696e672d7374616e64617264732e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d6461726b6379616e)](https://github.com/wptechnix/coding-standards/blob/master/LICENSE)

About
-----

[](#about)

This is a coding standard for [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer). It builds upon rules from [Slevomat Coding Standard](https://github.com/slevomat/coding-standard)and [PHPCSExtra](https://github.com/PHPCSStandards/PHPCSExtra), with a focus on:

**Type Safety:**

- `declare(strict_types=1)` required in all files
- Parameter, return, property, and class constant type hints required
- Union, intersection, and DNF types supported
- Disallows mixed type hint and array type hint syntax (use generics in PHPDoc)
- Strict comparison operators (`===`, `!==`) enforced

**Modern PHP 8.0+ Features:**

- Constructor property promotion required
- Arrow functions required for single-expression closures
- Null-safe operator and null coalesce operators required where applicable
- Non-capturing catch blocks (PHP 8.0+)
- Numeric literal separators for readability
- Trailing commas in multiline structures

**Immutability &amp; Code Quality:**

- Readonly properties enforced, public mutable properties forbidden
- Disallows `empty()` function
- Early returns required
- Alphabetically sorted use statements and array keys
- Proper class member ordering and spacing
- PHPDoc requirements with proper formatting

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

[](#installation)

Install this package as a development dependency using [Composer](https://getcomposer.org).

```
composer require --dev "wptechnix/coding-standards:^2.0"
```

### Automatic Registration (Optional)

[](#automatic-registration-optional)

For automatic registration of the standard with PHP\_CodeSniffer, optionally install the [Dealerdirect Composer Installer](https://github.com/Dealerdirect/phpcodesniffer-composer-installer):

```
composer require --dev dealerdirect/phpcodesniffer-composer-installer
```

Without Dealerdirect, you can still use the standard by manually referencing it in your `phpcs.xml` file.

Usage
-----

[](#usage)

To use this coding standard, add `` to your `phpcs.xml`configuration.

Here are the contents of an example `phpcs.xml.dist` file that you may place in the root of your repository:

```

    ./src
    ./tests

```

Then, run PHP\_CodeSniffer:

```
./vendor/bin/phpcs
```

To automatically fix violations:

```
./vendor/bin/phpcbf
```

Project-Specific Coding Standards
---------------------------------

[](#project-specific-coding-standards)

This base standard can be extended for project-specific coding requirements. The following projects xtend WPTechnix coding standards:

- [WPTechnix WordPress Coding Standards](https://github.com/WPTechnix/wordpress-coding-standards) - Extends this standard with WordPress-specific rules and conventions

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

[](#contributing)

Contributions are welcome! To contribute, please familiarize yourself with [CONTRIBUTING.md](CONTRIBUTING.md).

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

[](#copyright-and-license)

The wptechnix/coding-standards library is copyright © [WPTechnix](https://wptechnix.com)and licensed for use under the terms of the MIT License (MIT). Please see [LICENSE](LICENSE) for more information.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance84

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.6% 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 ~5 days

Total

10

Last Release

133d ago

Major Versions

v1.2.0 → v2.0.02025-11-26

### Community

Maintainers

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

---

Top Contributors

[![owaisahmed5300](https://avatars.githubusercontent.com/u/28684548?v=4)](https://github.com/owaisahmed5300 "owaisahmed5300 (20 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

code-qualitycoding-standardcoding-standardsphpcspsr-12standardsstatic-analysiswptechnixstandardsphpcsstatic analysiscode qualitycoding-standardsCoding Standardpsr-12wptechnix

### Embed Badge

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

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

###  Alternatives

[wp-coding-standards/wpcs

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

2.8k42.5M1.6k](/packages/wp-coding-standards-wpcs)[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

598161.9M1.9k](/packages/dealerdirect-phpcodesniffer-composer-installer)[escapestudios/symfony2-coding-standard

CodeSniffer ruleset for the Symfony 2+ coding standard

40611.1M275](/packages/escapestudios-symfony2-coding-standard)[phpcompatibility/phpcompatibility-wp

A ruleset for PHP\_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.

22130.6M587](/packages/phpcompatibility-phpcompatibility-wp)[phpcsstandards/phpcsextra

A collection of sniffs and standards for use with PHP\_CodeSniffer.

10324.3M44](/packages/phpcsstandards-phpcsextra)[inpsyde/php-coding-standards

PHP 7.4+ coding standards for Syde WordPress projects.

101163.9k45](/packages/inpsyde-php-coding-standards)

PHPackages © 2026

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