PHPackages                             johnatas-x/coder - 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. johnatas-x/coder

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

johnatas-x/coder
================

Coder is a library to review Drupal code.

9.0.0(7mo ago)012GPL-2.0-or-laterPHPPHP &gt;=7.2

Since Oct 11Pushed 7mo agoCompare

[ Source](https://github.com/johnatas-x/coder)[ Packagist](https://packagist.org/packages/johnatas-x/coder)[ Docs](https://www.drupal.org/project/coder)[ RSS](/packages/johnatas-x-coder/feed)WikiDiscussions 8.3.x Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

Coder
=====

[](#coder)

[![Automated tests](https://github.com/pfrenssen/coder/workflows/Tests/badge.svg)](https://github.com/pfrenssen/coder/actions)

Coder is a library for automated Drupal code reviews and coding standard fixes. It defines rules for [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)

Built-in support for:

- "Drupal": Coding Standards
- "DrupalPractice": Best practices for Drupal module development

Online documentation:

Note that Javascript support has been removed. To check and fix Javascript files please use [ESLint](http://eslint.org/) and see the [Drupal ESLint](https://www.drupal.org/node/1955232) documentation.

Global installation
-------------------

[](#global-installation)

First, make sure Composer is installed correctly:

```
which composer

```

If you get composer not found or similar, follow Composer's installation instructions.

Install Coder (8.3.x) in your global Composer directory in your home directory (`~/.config/composer`):

```
composer global require drupal/coder

```

To make the `phpcs` and `phpcbf` commands available globally, add the Composer bin path to your `$PATH` variable in `~/.profile`, `~/.bashrc` or `~/.zshrc`:

```
export PATH="$PATH:$HOME/.config/composer/vendor/bin"

```

Usage
-----

[](#usage)

Check Drupal coding standards

```
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /file/to/drupal/example_module

```

Check Drupal best practices

```
phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /file/to/drupal/example_module

```

Automatically fix coding standards

```
phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /file/to/drupal/example_module

```

Local installation in your Drupal project
-----------------------------------------

[](#local-installation-in-your-drupal-project)

For collaborating developer teams it makes sense to lock a Coder version with your other development dependencies locally. In your project where you have your composer.json file execute this:

```
composer require --dev drupal/coder

```

Then you can run Coder on your custom module code like this:

```
./vendor/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/custom

```

To simplify execution it is highly recommended to use a settings file, see below.

Store settings in a phpcs.xml.dist file
---------------------------------------

[](#store-settings-in-a-phpcsxmldist-file)

In order to save and commit your PHPCS settings to Git you can use a phpcs.xml.dist file in your project like this:

```

  PHP CodeSniffer configuration for example development.

  .

```

Then you can invoke phpcs without any options and it will read phpcs.xml.dist from the current directory. This can also be useful for Continuous Integration setups. Example:

```
./vendor/bin/phpcs -p

```

Working with Editors
--------------------

[](#working-with-editors)

Drupal Code Sniffer can be used with various editors.

Editors:

- [Atom](https://www.drupal.org/node/1419996)
- [Eclipse](https://www.drupal.org/node/1420004)
- [Komodo](https://www.drupal.org/node/1419996)
- [Netbeans](https://www.drupal.org/node/1420008)
- [PhpStorm](https://www.jetbrains.com/help/phpstorm/php-code-sniffer.html)
- [Sublime Text](https://www.drupal.org/node/1419996)
- [Vim](https://www.drupal.org/node/1419996)
- [Visual Studio Code (VSCode)](https://www.drupal.org/node/1419996)

Automated Testing (PHPUnit + PHPCS + PHPStan)
---------------------------------------------

[](#automated-testing-phpunit--phpcs--phpstan)

Coder Sniffer comes with a PHPUnit test suite to make sure the sniffs work correctly. Use Composer to install the dependencies:

```
composer install

```

Then execute the tests:

```
./vendor/bin/phpunit

```

Then execute the coding standards checker on Coder itself:

```
./vendor/bin/phpcs

```

Then execute static analysis:

```
./vendor/bin/phpstan

```

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

[](#contributing)

1. Make sure an issue exists at
2. Create a [Pull Request](https://help.github.com/articles/using-pull-requests/) against
3. Post a link to the pull request to the issue on drupal.org and set the issue to "needs review"

Thank you!

Maintainers
-----------

[](#maintainers)

\[//\]: # cspell:ignore Pieter Frenssen Welford

- Pieter Frenssen,
- Michael Welford,
- Klaus Purer,

Credits
-------

[](#credits)

Greg Sherwood and Squiz Pty Ltd, many sniffs are modified copies of their original work on [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance64

Regular maintenance activity

Popularity5

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 63.5% 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 ~0 days

Total

3

Last Release

219d ago

Major Versions

8.3.x-dev → 9.0.02025-10-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb82429ffeb7556ffee9014525e0ba5d3a32cf3a525d6a5e48135ccd50626925?d=identicon)[johnatas-x](/maintainers/johnatas-x)

---

Top Contributors

[![klausi](https://avatars.githubusercontent.com/u/213229?v=4)](https://github.com/klausi "klausi (866 commits)")[![douggreen](https://avatars.githubusercontent.com/u/1244341?v=4)](https://github.com/douggreen "douggreen (282 commits)")[![solotandem](https://avatars.githubusercontent.com/u/314718?v=4)](https://github.com/solotandem "solotandem (41 commits)")[![arkener](https://avatars.githubusercontent.com/u/16407031?v=4)](https://github.com/arkener "arkener (28 commits)")[![snpower](https://avatars.githubusercontent.com/u/1731285?v=4)](https://github.com/snpower "snpower (26 commits)")[![pfrenssen](https://avatars.githubusercontent.com/u/442924?v=4)](https://github.com/pfrenssen "pfrenssen (21 commits)")[![sun](https://avatars.githubusercontent.com/u/41992?v=4)](https://github.com/sun "sun (19 commits)")[![jonathan1055](https://avatars.githubusercontent.com/u/19403539?v=4)](https://github.com/jonathan1055 "jonathan1055 (17 commits)")[![das-peter](https://avatars.githubusercontent.com/u/177531?v=4)](https://github.com/das-peter "das-peter (16 commits)")[![ericduran](https://avatars.githubusercontent.com/u/118016?v=4)](https://github.com/ericduran "ericduran (6 commits)")[![alexpott](https://avatars.githubusercontent.com/u/769634?v=4)](https://github.com/alexpott "alexpott (4 commits)")[![eiriksm](https://avatars.githubusercontent.com/u/865153?v=4)](https://github.com/eiriksm "eiriksm (4 commits)")[![Boegie](https://avatars.githubusercontent.com/u/18569707?v=4)](https://github.com/Boegie "Boegie (4 commits)")[![LOBsTerr](https://avatars.githubusercontent.com/u/537500?v=4)](https://github.com/LOBsTerr "LOBsTerr (3 commits)")[![christopher-hopper](https://avatars.githubusercontent.com/u/452515?v=4)](https://github.com/christopher-hopper "christopher-hopper (3 commits)")[![johnatas-x](https://avatars.githubusercontent.com/u/34005481?v=4)](https://github.com/johnatas-x "johnatas-x (3 commits)")[![mfernea](https://avatars.githubusercontent.com/u/146230?v=4)](https://github.com/mfernea "mfernea (3 commits)")[![adamzimmermann](https://avatars.githubusercontent.com/u/1349906?v=4)](https://github.com/adamzimmermann "adamzimmermann (2 commits)")[![cburschka](https://avatars.githubusercontent.com/u/1448001?v=4)](https://github.com/cburschka "cburschka (2 commits)")[![chipway](https://avatars.githubusercontent.com/u/1422820?v=4)](https://github.com/chipway "chipway (2 commits)")

---

Tags

standardsphpcscode review

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/johnatas-x-coder/health.svg)

```
[![Health](https://phpackages.com/badges/johnatas-x-coder/health.svg)](https://phpackages.com/packages/johnatas-x-coder)
```

###  Alternatives

[drupal/coder

Coder is a library to review Drupal code.

3043.6M461](/packages/drupal-coder)[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)[yoast/yoastcs

PHP\_CodeSniffer rules for Yoast projects

221.1M29](/packages/yoast-yoastcs)[acquia/coding-standards

PHP\_CodeSniffer rules (sniffs) for Acquia coding standards

214.8M28](/packages/acquia-coding-standards)[ec-europa/qa-automation

Extra php codesniffs for QualityAssurance.

10290.4k3](/packages/ec-europa-qa-automation)[mayflower/mo4-coding-standard

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

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

PHPackages © 2026

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