PHPackages                             mito/yii2-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. [Framework](/categories/framework)
4. /
5. mito/yii2-coding-standards

Abandoned → [composer require mito/coding-standards](/?search=composer%20require%20mito%2Fcoding-standards)Library[Framework](/categories/framework)

mito/yii2-coding-standards
==========================

Mito Yii 2 coding standards

1.0.2(9y ago)437.6k4[1 PRs](https://github.com/hellowearemito/yii2-coding-standards/pulls)6BSD-3-ClausePHPPHP &gt;=5.4.0

Since Aug 4Pushed 3y ago7 watchersCompare

[ Source](https://github.com/hellowearemito/yii2-coding-standards)[ Packagist](https://packagist.org/packages/mito/yii2-coding-standards)[ Docs](http://www.yiiframework.com/)[ RSS](/packages/mito-yii2-coding-standards/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (24)Used By (6)

Mito Yii 2 Coding Standards
===========================

[](#mito-yii-2-coding-standards)

This repository contains [Mito](https://mito.hu/)'s coding standards for Yii 2 based applications.

[![Build Status](https://camo.githubusercontent.com/963c31e2e0b9fcd6b26da18607f694e8147c63f4263d0ffd3d7b7d4e486cd670/68747470733a2f2f7472617669732d63692e6f72672f68656c6c6f77656172656d69746f2f796969322d636f64696e672d7374616e64617264732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hellowearemito/yii2-coding-standards)[![Coverage Status](https://camo.githubusercontent.com/b98e7a128259d2e2b8a6ee34e5db3fab7b66708683b7ba56f07360eb662e48ba/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f68656c6c6f77656172656d69746f2f796969322d636f64696e672d7374616e64617264732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/hellowearemito/yii2-coding-standards?branch=master)

Getting the code
----------------

[](#getting-the-code)

You can get code style definition using one of the following methods.

- Clone `hellowearemito/yii2-coding-standards` repository:

```
$ git clone git://github.com/hellowearemito/yii2-coding-standards.git

```

- Install using [composer](https://getcomposer.org/download/):

```
$ composer require mito/yii2-coding-standards:"~2.0.0@beta"

```

PHP\_Codesniffer
----------------

[](#php_codesniffer)

This repository contains five phpcs standards:

- `Application`: for normal class files.
- `Views`: for view files, requires using curly braces for control structures.
- `ViewsAlternate`: for view files, requires using alternate syntax for control structures.
- `ViewsMixed`: for view files, allows both curly braces and alternate syntax.
- `Others`: for other files, such as configuration files and migration classes.

These standards are based on PSR2 and Yii 2's coding standard, with some additions and improvements.

The `Views` standards disable some rules that cause problems when mixing php with html, and therefore cannot fully check view files and cannot fix all problems in them, so be careful when using phpcbf with view files.

For a full description of the rules, see [docs/rules.md](docs/rules.md).

### Using the standards

[](#using-the-standards)

After CodeSniffer is installed, you can launch it with a custom standard using the following syntax:

```
$ ./vendor/bin/phpcs --extensions=php --standard=vendor/mito/yii2-coding-standards/Application .

```

To automatically fix most issues, use phpcbf:

```
$ ./vendor/bin/phpcbf --extensions=php --standard=vendor/mito/yii2-coding-standards/Application .

```

**Warning**: always check phpcbf's output and keep backups. If it breaks your code, you get to keep both pieces.

You should also run a syntax check using `php -l` before running phpcbf, because some sniffs assume the code is syntactically valid, and may mangle it if it is not.

If you're using PhpStorm you can configure it to use CodeSniffer using Settings → PHP → Code Sniffer. The standard can be specified at Inspections → PHP → PHP Code Sniffer validation.

Note that this will check all your files with a single standard, but you should use different standards for different types of files. These standards were designed for use with [gulp-phpcs](https://www.npmjs.com/package/gulp-phpcs) and [gulp-phpcbf](https://www.npmjs.com/package/gulp-phpcbf), so instead of using exclusion patterns in the `ruleset.xml`, they rely on the gulp task selecting the appropriate standard for a file.

You can write your own `ruleset.xml` that extends from the `Application` standard and contains appropriate exclusion patterns (check the `Others` and `Views` `ruleset.xml` files for what rules to exclude).

### Useful links

[](#useful-links)

- [Configuration options](http://pear.php.net/manual/en/package.php.php-codesniffer.config-options.php)
- [Manual and guide](http://pear.php.net/manual/en/package.php.php-codesniffer.php)
- [GitHub repository](https://github.com/squizlabs/PHP_CodeSniffer)

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

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md) for information.

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 72.7% 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 ~140 days

Recently: every ~543 days

Total

22

Last Release

1344d ago

Major Versions

0.9.0 → 2.0.0-beta12016-05-23

1.0.2 → 2.0.0-beta32016-05-27

2.x-dev → 3.x-dev2022-09-02

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40475?v=4)[mito](/maintainers/mito)[@mito](https://github.com/mito)

---

Top Contributors

[![nkovacs](https://avatars.githubusercontent.com/u/2269242?v=4)](https://github.com/nkovacs "nkovacs (72 commits)")[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (7 commits)")[![nkovacs2](https://avatars.githubusercontent.com/u/9216060?v=4)](https://github.com/nkovacs2 "nkovacs2 (7 commits)")[![resurtm](https://avatars.githubusercontent.com/u/100198?v=4)](https://github.com/resurtm "resurtm (4 commits)")[![cebe](https://avatars.githubusercontent.com/u/189796?v=4)](https://github.com/cebe "cebe (3 commits)")[![AlexGx](https://avatars.githubusercontent.com/u/1571119?v=4)](https://github.com/AlexGx "AlexGx (2 commits)")[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (1 commits)")[![gsherwood](https://avatars.githubusercontent.com/u/185976?v=4)](https://github.com/gsherwood "gsherwood (1 commits)")[![qiangxue](https://avatars.githubusercontent.com/u/993322?v=4)](https://github.com/qiangxue "qiangxue (1 commits)")[![albertborsos](https://avatars.githubusercontent.com/u/7307145?v=4)](https://github.com/albertborsos "albertborsos (1 commits)")

---

Tags

frameworkcodesnifferyii

### Embed Badge

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

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

###  Alternatives

[yiisoft/yii2-coding-standards

Yii PHP Framework Version 2 - Coding standard tools

1831.0M165](/packages/yiisoft-yii2-coding-standards)[cakephp/cakephp-codesniffer

CakePHP CodeSniffer Standards

23711.0M654](/packages/cakephp-cakephp-codesniffer)[spryker/code-sniffer

Spryker Code Sniffer Standards

374.1M2.3k](/packages/spryker-code-sniffer)[hprose/hprose-yii

Hprose Server for Yii 2

357.1k](/packages/hprose-hprose-yii)[linnk/allman-codesniffer

Allman CodeSniffer &amp; Linnk Standards

121.8k](/packages/linnk-allman-codesniffer)[yiisoft/cache-apcu

Yii Caching Library - APCu Handler

136.5k](/packages/yiisoft-cache-apcu)

PHPackages © 2026

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