PHPackages                             vena/php-cs-fixer-wordpress - 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. vena/php-cs-fixer-wordpress

ActiveLibrary

vena/php-cs-fixer-wordpress
===========================

A custom ruleset for PHP CS Fixer (close to) Wordpress Coding Standards

v1.0.3(2y ago)22.2k1[1 PRs](https://github.com/vena/php-cs-fixer-wordpress/pulls)MITPHPPHP &gt;=7.0.0

Since Jul 12Pushed 2y ago2 watchersCompare

[ Source](https://github.com/vena/php-cs-fixer-wordpress)[ Packagist](https://packagist.org/packages/vena/php-cs-fixer-wordpress)[ RSS](/packages/vena-php-cs-fixer-wordpress/feed)WikiDiscussions main Synced 1mo ago

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

WordPress php-cs-fixer ruleset
==============================

[](#wordpress-php-cs-fixer-ruleset)

This package contains a Frankenstein's monster of rules and fixers for [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) which attempt to satisfy most of the WordPress Coding Standards. It builds upon the @PSR2 and @PhpCsFixer rulesets, along with custom fixers for some WordPress peculiarities.

WPCS rules not covered by this package include, but are not limited to:

- Filename conventions
- Tabs vs Spaces
- Nearly all errors and warnings which are not automatically fixable

Yoda style looks to no longer be required in WPCS 3.0, so it is not required in this ruleset.

I use PHP CS Fixer because I find it easier to integrate into my workflow than PHP\_CodeSniffer. If you are not me, and especially if you require WPCS compliance, I highly suggest that you stick with [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) and [the official WPCS sniffs](https://github.com/WordPress/WordPress-Coding-Standards).

Use
---

[](#use)

```
// In case of not using autoload...
require __DIR__ . '/includes.php';

$config = new PhpCsFixer\Config();
$RuleSet = new vena\WordPress\PhpCsFixer\WordPressRuleSet();

return $config
	->registerCustomFixers( $RuleSet->getCustomFixers() )
	// OPTIONAL. See below.
	->registerCustomFixers( array(
		new vena\WordPress\PhpCsFixer\Fixer\WordPressCapitalPDangitFixer(),
	) )
	->setRiskyAllowed( $RuleSet->isRisky() )
	->setIndent( "\t" )
	->setRules( array_merge(
		$RuleSet->getRules(),
		array(
			// OPTIONAL. See below.
			'Vena/wp_capital_p_dangit' => true,
		)
	) )
	->setFinder(
		PhpCsFixer\Finder::create()
			->exclude( 'vendor' )
			->in( __DIR__ )
	)
;
```

Custom Fixers
-------------

[](#custom-fixers)

### WordPressParenthesesSpacesFixer

[](#wordpressparenthesesspacesfixer)

With few exceptions, WPCS specifies spaces after opening and before closing parenthesis.

### WordPressArrayIndexSpacesFixer

[](#wordpressarrayindexspacesfixer)

If a variable is used as an array key, it must be flanked by spaces. All other keys should not have spaces.

### WordPressMultilineAssocArrayFixer

[](#wordpressmultilineassocarrayfixer)

For any array which contains multiple items and any associative key, each item must appear on a new line. NOTE: This fixer DOES NOT fix indentation, and should be used with the `array_indentation` rule.

### WordPressCapitalPDangitFixer

[](#wordpresscapitalpdangitfixer)

Attempts to automatically correct common misspellings of WordPress in strings and comments. Its rule, `Vena/wp_capital_p_dangit`, is not included in the `RuleSet::getRules()` helper, and must be added to your config if you intend to use it. Unlike the official WPCS sniff, this does not care about class names. NOTE: This is a risky fixer that may not accurately distinguish safe transforms.

Credits
-------

[](#credits)

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

[WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards).

Test scaffolding is built on the work of Kuba Werłos' [PHP CS Fixer: custom fixers](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

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

Total

4

Last Release

1060d ago

### Community

Maintainers

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

---

Top Contributors

[![vena](https://avatars.githubusercontent.com/u/867733?v=4)](https://github.com/vena "vena (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vena-php-cs-fixer-wordpress/health.svg)

```
[![Health](https://phpackages.com/badges/vena-php-cs-fixer-wordpress/health.svg)](https://phpackages.com/packages/vena-php-cs-fixer-wordpress)
```

###  Alternatives

[kubawerlos/php-cs-fixer-custom-fixers

A set of custom fixers for PHP CS Fixer

23812.0M145](/packages/kubawerlos-php-cs-fixer-custom-fixers)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[ergebnis/php-cs-fixer-config

Provides a configuration factory and rule set factories for friendsofphp/php-cs-fixer.

692.9M163](/packages/ergebnis-php-cs-fixer-config)[slam/php-cs-fixer-extensions

Slam extension of friendsofphp/php-cs-fixer

68947.7k20](/packages/slam-php-cs-fixer-extensions)[jubeki/laravel-code-style

Combine Custom Fixers with the ruleset of Laravel Pint to fix your code style in Laravel Applications/Packages.

56521.7k8](/packages/jubeki-laravel-code-style)[redaxo/php-cs-fixer-config

php-cs-fixer config for REDAXO

1091.3k8](/packages/redaxo-php-cs-fixer-config)

PHPackages © 2026

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