PHPackages                             yeremi/cli-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. [CLI &amp; Console](/categories/cli)
4. /
5. yeremi/cli-standards

ActivePhpcodesniffer-standard[CLI &amp; Console](/categories/cli)

yeremi/cli-standards
====================

PHPCS standards for CLI command design, currently focused on WP-CLI code, with blocking and advisory sniffs for safety, automation, output, and documentation.

v1.0.0(1mo ago)00MITPHPPHP &gt;=7.4CI passing

Since Apr 23Pushed 1mo agoCompare

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

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

CLIStandards PHPCS Standard
===========================

[](#clistandards-phpcs-standard)

PHPCS sniffs for CLI command design quality, currently focused on WP-CLI command code.

This package publishes the `CLIStandards` coding standard as a Packagist-ready Composer package. It enforces 18 checks derived from the CLI Standards model:

- 8 blocking checks reported as errors
- 10 advisory checks reported as warnings

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

[](#installation)

```
composer require --dev yeremi/cli-standards
```

The Composer installer plugin registers the standards automatically. After installation:

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

You should see `CLIStandards` and `CLIStandardsMust` in the installed standards list.

Usage
-----

[](#usage)

Run the standard against your CLI command code:

```
vendor/bin/phpcs --standard=CLIStandards path/to/cli/
```

Useful variants:

```
# Show sniff codes.
vendor/bin/phpcs --standard=CLIStandards -s path/to/cli/

# Enforce only MUST-level checks.
vendor/bin/phpcs --standard=CLIStandards --warning-severity=0 path/to/cli/

# Emit JSON for CI tooling.
vendor/bin/phpcs --standard=CLIStandards --report=json path/to/cli/

# Run only blocking rules.
vendor/bin/phpcs --standard=CLIStandardsMust path/to/cli/
```

`CLIStandardsMust` is intended to behave like `CLIStandards` with warnings suppressed, which makes it useful for staged CI adoption.

Example Output
--------------

[](#example-output)

Anonymized example from a real local scan:

```
FILE: sample-plugin/includes/cli/class-command.php
----------------------------------------------------------------------
FOUND 4 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------
  9 | ERROR   | Command name "sample-command" must include a namespace
    |         | (CLIStandards.CommandStructure.CommandRegistration.MissingNamespace)
 24 | ERROR   | Command docblock must contain a "## OPTIONS" section
    |         | (CLIStandards.Documentation.DocblockOptions.MissingOptionsSection)
 25 | ERROR   | Command docblock must contain a "## EXAMPLES" section
    |         | (CLIStandards.Documentation.DocblockExamples.MissingExamplesSection)
 48 | WARNING | Consider using WP_CLI\Utils\get_flag_value()
    |         | (CLIStandards.Arguments.FlagExtraction.DirectAccess)
 77 | WARNING | Bulk loop should use make_progress_bar()
    |         | (CLIStandards.Scalability.ProgressBar.MissingProgressBar)
----------------------------------------------------------------------

```

What It Enforces
----------------

[](#what-it-enforces)

Error-level sniffs:

- `CommandRegistration`
- `FlagNaming`
- `OutputMethod`
- `ErrorSeverity`
- `ConfirmOnDelete`
- `ConfirmPassthrough`
- `DocblockOptions`
- `DocblockExamples`

Warning-level sniffs:

- `FlagExtraction`
- `StdoutStderr`
- `FormatSupport`
- `AvailableFields`
- `WpErrorHandling`
- `DryRunSupport`
- `BatchProcessing`
- `ProgressBar`
- `BatchSizeFlag`
- `SinceAnnotation`

The implementation is intentionally heuristic in some areas. It favors practical signal over deep semantic analysis, so some checks can still produce false negatives or advisory-only warnings.

Scope
-----

[](#scope)

The standard name is generic, but the current implementation is not framework-agnostic. The sniffs are tuned for codebases that expose commands through `WP_CLI`, and most checks activate only when `WP_CLI` usage is detected.

Add To `phpcs.xml.dist`
-----------------------

[](#add-to-phpcsxmldist)

```

    Project coding standards.

    ./includes/cli/
    */vendor/*

```

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

[](#development)

Install dependencies:

```
composer install
```

Run the fixture-based regression suite:

```
composer test
```

For contribution workflow and expectations, see `CONTRIBUTING.md`.

Repository Layout
-----------------

[](#repository-layout)

- `CLIStandards/`: the main standard and sniff classes
- `CLIStandardsMust/`: blocking-only variant for staged adoption
- `tests/Fixtures/`: regression fixtures for expected violations and clean cases
- `scripts/verify-fixtures.php`: assertion-based test runner used by CI

License
-------

[](#license)

See LICENSE ([MIT](LICENSE)).

###  Health Score

33

—

LowBetter than 73% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

47d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/744184?v=4)[Yeremi Loli](/maintainers/Yeremi)[@yeremi](https://github.com/yeremi)

---

Top Contributors

[![yeremi](https://avatars.githubusercontent.com/u/744184?v=4)](https://github.com/yeremi "yeremi (1 commits)")

---

Tags

cli-commandcoding-conventionsphp-codesnifferphpcsrulesetphpcscliwordpressstatic analysisPHPCodeSnifferwp-clicoding-standards

### Embed Badge

![Health badge](/badges/yeremi-cli-standards/health.svg)

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

###  Alternatives

[slevomat/coding-standard

Slevomat Coding Standard for PHP\_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.

1.5k130.4M2.1k](/packages/slevomat-coding-standard)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1902.3M39](/packages/dereuromark-cakephp-ide-helper)[inpsyde/php-coding-standards

PHP 7.4+ coding standards for Syde WordPress projects.

101169.9k46](/packages/inpsyde-php-coding-standards)[wp-cli/wp-cli-tests

WP-CLI testing framework

423.0M129](/packages/wp-cli-wp-cli-tests)[yoast/yoastcs

PHP\_CodeSniffer rules for Yoast projects

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

Syde PHP coding standards for WordPress projects.

1024.3k8](/packages/syde-phpcs)

PHPackages © 2026

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