PHPackages                             automattic/phpcs-cobalt-ruleset - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. automattic/phpcs-cobalt-ruleset

ActivePhpcodesniffer-standard[Validation &amp; Sanitization](/categories/validation)

automattic/phpcs-cobalt-ruleset
===============================

1.1(6y ago)2301MIT

Since Jan 16Pushed 6y ago2 watchersCompare

[ Source](https://github.com/Automattic/phpcs-cobalt-ruleset)[ Packagist](https://packagist.org/packages/automattic/phpcs-cobalt-ruleset)[ RSS](/packages/automattic-phpcs-cobalt-ruleset/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (6)Versions (4)Used By (0)

Cobalt PHP Ruleset
==================

[](#cobalt-php-ruleset)

These are a set of modern (PHP &gt;7) linting guidelines for WordPress development. Because of the newer PHP version, it is not suitable for work on Core WordPress, but may be useful for those who are not bound by PHP 5.2.

These guidelines are being developed primarily for a team within [Automattic](https://automattic.com/), but anyone is free to use them, suggest changes, or report bugs.

This project is a [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) "standard" (a collection of rules or "sniffs") that can be included in any project.

This is a meta-project in that it's just a collection of rules defined in these packages with certain modifications:

- [WordPress Coding Standards](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards)
- [VariableAnalysis](https://github.com/sirbrillig/phpcs-variable-analysis)
- [CobaltStandard](https://github.com/Automattic/phpcs-cobalt-standard)

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

[](#installation)

To use these rules in a project which is set up using [composer](https://href.li/?https://getcomposer.org/), we recommend using the [phpcodesniffer-composer-installer library](https://href.li/?https://github.com/DealerDirect/phpcodesniffer-composer-installer) which will automatically use all installed standards in the current project with the composer type `phpcodesniffer-standard` when you run phpcs.

```
composer require --dev squizlabs/php_codesniffer dealerdirect/phpcodesniffer-composer-installer
composer require --dev automattic/phpcs-cobalt-ruleset

```

Configuration
-------------

[](#configuration)

When installing sniff standards in a project, you edit a `phpcs.xml` file with the `rule` tag inside the `ruleset` tag. The `ref` attribute of that tag should specify a standard, category, sniff, or error code to enable. It’s also possible to use these tags to disable or modify certain rules. The [official annotated file](https://href.li/?https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml) explains how to do this.

The following configuration will enable all the sniffs in this ruleset.

```

 My library.

```

Usage
-----

[](#usage)

Most editors have a phpcs plugin available, but you can also run phpcs manually. To run phpcs on a file in your project, just use the command-line as follows (the `-s` causes the sniff code to be shown, which is very important for learning about an error).

```
vendor/bin/phpcs -s src/MyProject/MyClass.php

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 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 ~567 days

Total

2

Last Release

2468d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c5869ecbb8e0eac7e8b8e0f3cf7bdd8d5fcdc4abc10a72281872c53f8639d44?d=identicon)[automattic](/maintainers/automattic)

![](https://www.gravatar.com/avatar/264b42a3c85c1b6c390dcaca3139cfa9402ebb90f4d2302e17318041cd1cdca9?d=identicon)[xyu](/maintainers/xyu)

---

Top Contributors

[![delputnam](https://avatars.githubusercontent.com/u/1379730?v=4)](https://github.com/delputnam "delputnam (5 commits)")[![matthusby](https://avatars.githubusercontent.com/u/363753?v=4)](https://github.com/matthusby "matthusby (4 commits)")[![sirbrillig](https://avatars.githubusercontent.com/u/2036909?v=4)](https://github.com/sirbrillig "sirbrillig (2 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/automattic-phpcs-cobalt-ruleset/health.svg)

```
[![Health](https://phpackages.com/badges/automattic-phpcs-cobalt-ruleset/health.svg)](https://phpackages.com/packages/automattic-phpcs-cobalt-ruleset)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[drupal/coder

Coder is a library to review Drupal code.

3043.6M460](/packages/drupal-coder)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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