PHPackages                             ocreaper/naming-convention-analyzer - 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. ocreaper/naming-convention-analyzer

ActivePhpcodesniffer-standard

ocreaper/naming-convention-analyzer
===================================

Checks for predefined naming convention

0.4.1(5y ago)49[1 issues](https://github.com/ocReaper/naming-convention-analyzer/issues)MITPHPPHP ^7.1

Since Jan 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ocReaper/naming-convention-analyzer)[ Packagist](https://packagist.org/packages/ocreaper/naming-convention-analyzer)[ RSS](/packages/ocreaper-naming-convention-analyzer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

ocReaper naming convention analyzer
===================================

[](#ocreaper-naming-convention-analyzer)

[![Latest version](https://camo.githubusercontent.com/92be0bd5d018b8c489d5058a0285723b6b0a0efc09622775f12880c7469316b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f637265617065722f6e616d696e672d636f6e76656e74696f6e2d616e616c797a65722e7376673f636f6c6f72423d303037454336)](https://packagist.org/packages/ocreaper/naming-convention-analyzer)[![Downloads](https://camo.githubusercontent.com/3dd100852cdad7c9878459c35d5bc9dd84ec15c9583e91d1845f6feb003588ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f637265617065722f6e616d696e672d636f6e76656e74696f6e2d616e616c797a65722e7376673f636f6c6f72423d303037454336)](https://packagist.org/packages/ocreaper/naming-convention-analyzer)

ocReaper naming convention analyzer for [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) provides sniffs that ensure proper variable and function naming.

The ensured convention is identical to [kettanaito/naming-cheatsheet](https://github.com/kettanaito/naming-cheatsheet).

The project uses [tbrianjones/Inflect.php](https://gist.github.com/tbrianjones/ba0460cc1d55f357e00b) to handle pluralization.

Table of contents
-----------------

[](#table-of-contents)

1. [Sniffs included in this standard](#sniffs-included-in-this-standard)
2. [Installation](#installation)
3. [How to run the sniffs](#how-to-run-the-sniffs)

- [Choose which sniffs to run](#choose-which-sniffs-to-run)
- [Using all sniffs from the standard](#using-all-sniffs-from-the-standard)

4. [Fixing errors automatically](#fixing-errors-automatically)
5. [Suppressing sniffs locally](#suppressing-sniffs-locally)
6. [Contributing](#contributing)

Sniffs included in this standard
--------------------------------

[](#sniffs-included-in-this-standard)

🔧 = [Automatic errors fixing](#fixing-errors-automatically)

#### NamingConventionAnalyzer.Functions.ActionPrefix

[](#namingconventionanalyzerfunctionsactionprefix)

Ensures that a function must start with a verb. In case the function starts with a prefix: the second word will be used in check.

#### NamingConventionAnalyzer.Functions.BoolPrefix

[](#namingconventionanalyzerfunctionsboolprefix)

Ensures that functions that returns boolean value must start with:

- has
- is
- should

#### NamingConventionAnalyzer.Functions.ContextDuplication

[](#namingconventionanalyzerfunctionscontextduplication)

Ensures that a function does not duplicate the name of the class it belongs to.

#### NamingConventionAnalyzer.Variables.ContextDuplication

[](#namingconventionanalyzervariablescontextduplication)

Ensures that a variable does not duplicate the name of the function it belongs to.

#### NamingConventionAnalyzer.Variables.SingularPlural

[](#namingconventionanalyzervariablessingularplural)

Ensures that the name of those variables that are containing non-associative arrays are in plural.

#### Squiz.NamingConventions.ValidFunctionName.NotCamelCaps

[](#squiznamingconventionsvalidfunctionnamenotcamelcaps)

Ensures that function names are in camel case.

#### Squiz.NamingConventions.ValidVariableName.NotCamelCaps

[](#squiznamingconventionsvalidvariablenamenotcamelcaps)

Ensures that variable names are in camel case.

#### Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps

[](#squiznamingconventionsvalidvariablenamemembernotcamelcaps)

Ensures that class member names are in camel case.

#### Squiz.NamingConventions.ValidVariableName.StringNotCamelCaps

[](#squiznamingconventionsvalidvariablenamestringnotcamelcaps)

Ensures that variable names inside a doublequoted string are in camel case.

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

[](#installation)

The recommended way to install ocReaper naming convention analyzer is [through Composer](http://getcomposer.org).

```
{
    "require-dev": {
        "ocreaper/naming-convention-analyzer": "0.4.1"
    }
}
```

How to run the sniffs
---------------------

[](#how-to-run-the-sniffs)

You can choose one of two ways to run only selected sniffs from the standard on your codebase:

### Choose which sniffs to run

[](#choose-which-sniffs-to-run)

The recommended way is to write your own ruleset.xml by referencing only the selected sniffs. This is a sample ruleset.xml:

```

```

Then run the `phpcs` executable the usual way:

```
vendor/bin/phpcs --standard=ruleset.xml --extensions=php --tab-width=4 -sp src tests

```

### Exclude sniffs you don't want to run

[](#exclude-sniffs-you-dont-want-to-run)

You can also mention ocReaper naming convention analyzer in your project's `ruleset.xml` and exclude only some sniffs:

```

```

However it is not a recommended way to use ocReaper naming convention analyzer, because your build can break when moving between minor versions of the standard (which can happen if you use `^` or `~` version constraint in `composer.json`). I regularly add new sniffs even in minor versions meaning your code won't most likely comply with new minor versions of the package.

Fixing errors automatically
---------------------------

[](#fixing-errors-automatically)

Sniffs in this standard marked by the 🔧 symbol support [automatic fixing of coding standard violations](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically). To fix your code automatically, run phpcbf instead of phpcs:

```
vendor/bin/phpcbf --standard=ruleset.xml --extensions=php --tab-width=4 -sp src tests

```

Always remember to back up your code before performing automatic fixes and check the results with your own eyes as the automatic fixer can sometimes produce unwanted results.

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

[](#contributing)

To make this repository work on your machine, clone it and run these two commands in the root directory of the repository:

```
composer install

```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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

Every ~1 days

Total

2

Last Release

1931d ago

### Community

Maintainers

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

---

Top Contributors

[![ocReaper](https://avatars.githubusercontent.com/u/4038188?v=4)](https://github.com/ocReaper "ocReaper (10 commits)")

### Embed Badge

![Health badge](/badges/ocreaper-naming-convention-analyzer/health.svg)

```
[![Health](https://phpackages.com/badges/ocreaper-naming-convention-analyzer/health.svg)](https://phpackages.com/packages/ocreaper-naming-convention-analyzer)
```

###  Alternatives

[slevomat/coding-standard

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

1.5k123.5M1.8k](/packages/slevomat-coding-standard)[drupal/coder

Coder is a library to review Drupal code.

3043.6M458](/packages/drupal-coder)[mayflower/mo4-coding-standard

PHP CodeSniffer ruleset implementing the MO4 coding standards extending the Symfony coding standards.

17508.3k5](/packages/mayflower-mo4-coding-standard)[chromatic/usher

A collection of Robo commands for use on Chromatic projects.

13534.3k1](/packages/chromatic-usher)[youwe/testing-suite

Contains Youwe's default testing packages for php.

13176.9k8](/packages/youwe-testing-suite)

PHPackages © 2026

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