PHPackages                             joomla/coding-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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. joomla/coding-standards

ActivePhpcodesniffer-standard[PSR &amp; Standards](/categories/psr-standards)

joomla/coding-standards
=======================

Joomla Coding Standards

3.0.0-alpha(6y ago)129231.7k—7.1%125[34 issues](https://github.com/joomla/coding-standards/issues)[1 PRs](https://github.com/joomla/coding-standards/pulls)16GPL-2.0-or-laterPHPPHP &gt;=5.4.0CI failing

Since Apr 10Pushed 2mo ago49 watchersCompare

[ Source](https://github.com/joomla/coding-standards)[ Packagist](https://packagist.org/packages/joomla/coding-standards)[ Docs](https://github.com/joomla/coding-standards)[ RSS](/packages/joomla-coding-standards/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (9)Used By (16)

**Since Joomla version 4.2, Joomla uses the PSR-12 coding standard.**

**We will update this soon to reflect this change**

**All not php coding standards are still valid**

---

Joomla Coding Standards [![Build Status](https://camo.githubusercontent.com/cd29a9b0b51cbbd37b56214314abfd6348dedda21c4ce69567c0592364b55ceb/68747470733a2f2f7472617669732d63692e6f72672f6a6f6f6d6c612f636f64696e672d7374616e64617264732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/joomla/coding-standards)
============================================================================================================================================================================================================================================================================================================================

[](#joomla-coding-standards-)

[![Latest Stable Version](https://camo.githubusercontent.com/fee396d35d5846f86bceb5a498ed3bcbc769f2ac2dde355c98b145af5ae4a3aa/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f636f64696e672d7374616e64617264732f762f737461626c652e737667)](https://packagist.org/packages/joomla/coding-standards) [![Latest Unstable Version](https://camo.githubusercontent.com/890f360d9f70b0576173099ef34becdb7cfeb8718ef90dd7c077fb3c21e33acc/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f636f64696e672d7374616e64617264732f762f756e737461626c652e737667)](https://packagist.org/packages/joomla/coding-standards) [![License](https://camo.githubusercontent.com/a9ef5678c3ffd270def3b7bfc3885705d8a68d960e8ba6b25f65c61033b6dbb7/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f636f64696e672d7374616e64617264732f6c6963656e73652e737667)](https://packagist.org/packages/joomla/coding-standards)

This repository includes the [Joomla](https://developer.joomla.org) coding standard definition for [PHP Codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) along with a few other helpful resources. The PHP\_CodeSniffer standard will never be 100% accurate, but should be viewed as a strong set of guidelines while writing software for Joomla.

See Joomla coding standards documentation at

If you want to contribute and improve this documentation, you can find the source files in the manual section of the master branch

Requirements
------------

[](#requirements)

- PHP 5.3+
- [PHP Codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) 2.8+

**Important note**: currently the latest PHPCS is the 3.x series. There is [a development branch](https://github.com/joomla/coding-standards/tree/3.x-dev) for the Joomla custom sniffs Which is compatible with the PHPCS 3.x series. Although PEAR and composer give you the option to install PHPCS 3.x by default the Joomla custom sniffs releases are currently only compatible with PHPCS 2.x and will not work, so we remind you to always install the PHPCS 2.x series if you are using the Joomla custom sniffs. If you want to test the [Joomla Code Standard development branch for PHPCS 3.x](https://github.com/joomla/coding-standards/tree/3.x-dev), please manually install the 3.x branch.

Installation via Composer
-------------------------

[](#installation-via-composer)

Add `"joomla/coding-standards": "~2.0"` to the require-dev block in your composer.json and then run `composer install`.

```
{
    "require-dev": {
		"joomla/coding-standards": "~2.0"
	}
}
```

Alternatively, you can simply run the following from the command line:

```
composer global require squizlabs/php_codesniffer "~2.8"
composer require joomla/coding-standards "~2.0"
```

As stability of joomla/coding-standards 2.0.0 is currently alpha, make sure you allow usage of alpha software in Composer: In Composer json

```
{
    "require-dev": {
		"joomla/coding-standards": "~2.0@alpha"
	}
}
```

or on the command line

```
composer config minimum-stability "alpha"
```

If you want to install the coding-standards globally, edit your Composer global configuration by running:

```
composer global config -e
```

and add the following: `"minimum-stability": "alpha"`

Once you have the coding standard files you can tell PHPCS where the standard folder is (i.e. install them in PHPCS)

```
phpcs --config-set installed_paths /path/to/joomla-coding-standards
```

Note: the composer scripts will run when the standard is installed globally, but not when it's a dependency. As such, you may want to run PHPCS config-set. When you run PHPCS config-set it will always overwrite the previous values. Use `--config-show` to check previous values before using `--config-set`So instead of overwriting the existing paths you should copy the existing paths revealed with `--config-show` and add each one separated by a comma: `phpcs --config-set installed_paths [path_1],[path_2],[/path/to/joomla-coding-standards]`

Running
-------

[](#running)

You can use the installed Joomla standard like:

```
phpcs --standard=Joomla path/to/code

```

Alternatively if it isn't installed you can still reference it by path like:

```
phpcs --standard=path/to/joomla/coding-standards path/to/code

```

### Selectively Applying Rules

[](#selectively-applying-rules)

For consuming packages there are some items that will typically result in creating their own project ruleset.xml, rather than just directly using the Joomla ruleset.xml. A project ruleset.xml allows the coding standard to be selectively applied for excluding 3rd party libraries, for consideration of backwards compatibility in existing projects, or for adjustments necessary for projects that do not need PHP 5.3 compatibility (which will be removed in a future version of the Joomla Coding Standard in connection of the end of PHP 5.3 support in all active Joomla Projects).

For information on [selectively applying rules read details in the PHP CodeSniffer wiki](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-Ruleset#selectively-applying-rules)

#### Common Rule Set Adjustments

[](#common-rule-set-adjustments)

The most common adjustment is to exclude folders with 3rd party libraries, or where the code has yet to have coding standards applied.

```

 build/*
 tests/*

 libraries/*
 vendor/*
```

Another common adjustment is to exclude the [camelCase format requirement](https://developer.joomla.org/coding-standards/php-code.html) for "Classes, Functions, Methods, Regular Variables and Class Properties" the essentially allows for B/C with snake\_case variables which were only allowed in the context of interacting with the database.

```

```

Old Protected method names were at one time prefixed with an underscore. These Protected method names with underscores are deprecated in Joomla projects but for B/C reasons are still in the projects. As such, excluding the MethodUnderscore sniff is a common ruleset adjustment

```

```

The last most common adjustment is removing PHP 5.3 specific rules which prevent short array syntax, and allowing short array syntax for method parameters.

```

```

Using example rulesets that Selectively Applying Rule
-----------------------------------------------------

[](#using-example-rulesets-that-selectively-applying-rule)

You have to tell you can tell PHPCS where the example ruleset folder is (i.e. install them in PHPCS)

```
phpcs --config-set installed_paths /path/to/joomla/coding-standards/Example-Rulesets
```

Note: the composer scripts will run when the standard is installed globally, but not when it's a dependency. As such, you may want to run PHPCS config-set. When you run PHPCS config-set it will always overwrite the previous values. Use `--config-show` to check previous values before using `--config-set`So instead of overwriting the existing paths you should copy the existing paths revealed with `--config-show` and add each one separated by a comma: `phpcs --config-set installed_paths [path_1],[path_2],[/path/to/joomla-coding-standards],[/path/to/joomla/coding-standards/Example-Rulesets]`

IDE autoformatters
------------------

[](#ide-autoformatters)

There is further information on how to set up IDE auto formatters here:

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance53

Moderate activity, may be stable

Popularity53

Moderate usage in the ecosystem

Community44

Growing community involvement

Maturity49

Maturing project, gaining track record

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

Recently: every ~237 days

Total

7

Last Release

2070d ago

Major Versions

2.0.0-rc3 → 3.0.0-alpha2020-01-21

PHP version history (2 changes)2.0.0-alphaPHP &gt;=5.3.10

3.0.0-alphaPHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/305a2164440014dcef9ac681c139fe5e8a1ce1d7a8c3b3cfb828497729a4c70e?d=identicon)[wilsonge](/maintainers/wilsonge)

---

Top Contributors

[![photodude](https://avatars.githubusercontent.com/u/10253980?v=4)](https://github.com/photodude "photodude (312 commits)")[![mbabker](https://avatars.githubusercontent.com/u/368545?v=4)](https://github.com/mbabker "mbabker (130 commits)")[![eddieajau](https://avatars.githubusercontent.com/u/700871?v=4)](https://github.com/eddieajau "eddieajau (53 commits)")[![wilsonge](https://avatars.githubusercontent.com/u/1986000?v=4)](https://github.com/wilsonge "wilsonge (38 commits)")[![LouisLandry](https://avatars.githubusercontent.com/u/698255?v=4)](https://github.com/LouisLandry "LouisLandry (20 commits)")[![CristinaSolana](https://avatars.githubusercontent.com/u/524896?v=4)](https://github.com/CristinaSolana "CristinaSolana (18 commits)")[![vess](https://avatars.githubusercontent.com/u/1426374?v=4)](https://github.com/vess "vess (18 commits)")[![zero-24](https://avatars.githubusercontent.com/u/2596554?v=4)](https://github.com/zero-24 "zero-24 (15 commits)")[![elinw](https://avatars.githubusercontent.com/u/754813?v=4)](https://github.com/elinw "elinw (14 commits)")[![javigomez](https://avatars.githubusercontent.com/u/1375475?v=4)](https://github.com/javigomez "javigomez (14 commits)")[![elkuku](https://avatars.githubusercontent.com/u/33978?v=4)](https://github.com/elkuku "elkuku (11 commits)")[![dongilbert](https://avatars.githubusercontent.com/u/718028?v=4)](https://github.com/dongilbert "dongilbert (9 commits)")[![nternetinspired](https://avatars.githubusercontent.com/u/1090182?v=4)](https://github.com/nternetinspired "nternetinspired (9 commits)")[![brianteeman](https://avatars.githubusercontent.com/u/1296369?v=4)](https://github.com/brianteeman "brianteeman (7 commits)")[![babsgosgens](https://avatars.githubusercontent.com/u/1268142?v=4)](https://github.com/babsgosgens "babsgosgens (7 commits)")[![PhilETaylor](https://avatars.githubusercontent.com/u/400092?v=4)](https://github.com/PhilETaylor "PhilETaylor (6 commits)")[![Hutchy68](https://avatars.githubusercontent.com/u/3527469?v=4)](https://github.com/Hutchy68 "Hutchy68 (6 commits)")[![HLeithner](https://avatars.githubusercontent.com/u/1497730?v=4)](https://github.com/HLeithner "HLeithner (5 commits)")[![rdeutz](https://avatars.githubusercontent.com/u/467356?v=4)](https://github.com/rdeutz "rdeutz (4 commits)")[![roland-d](https://avatars.githubusercontent.com/u/359377?v=4)](https://github.com/roland-d "roland-d (4 commits)")

---

Tags

joomlaphpphp-codesnifferphpcsphpcsPHP\_CodeSnifferjoomlacoding-standards

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/joomla-coding-standards/health.svg)

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

###  Alternatives

[phpcompatibility/php-compatibility

A set of sniffs for PHP\_CodeSniffer that checks for PHP cross-version compatibility.

2.3k74.3M1.3k](/packages/phpcompatibility-php-compatibility)[suin/phpcs-psr4-sniff

PHP\_CodeSniffer sniff that checks class name matches PSR-4 project structure.

271.7M16](/packages/suin-phpcs-psr4-sniff)[automattic/vipwpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress VIP minimum coding conventions

25510.2M145](/packages/automattic-vipwpcs)[wptrt/wpthemereview

PHP\_CodeSniffer rules (sniffs) to verify theme compliance with the rules for theme hosting on wordpress.org

217736.5k29](/packages/wptrt-wpthemereview)[yoast/yoastcs

PHP\_CodeSniffer rules for Yoast projects

221.1M29](/packages/yoast-yoastcs)[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)
