2017 © Pedro Pelรกez
 

phpcodesniffer-standard yii2-coding-standards

Yii PHP Framework Version 2 - Coding standard tools

image

yiisoft/yii2-coding-standards

Yii PHP Framework Version 2 - Coding standard tools

  • Friday, May 12, 2017
  • by cebe
  • Repository
  • 37 Watchers
  • 154 Stars
  • 117,047 Installations
  • PHP
  • 95 Dependents
  • 12 Suggesters
  • 48 Forks
  • 2 Open issues
  • 6 Versions
  • 8 % Grown

The README.md

Yii 2 Web Framework Coding Standard

This repository contains settings for Yii2 coding style for various tools., (*1)

Getting code

You can get code style definition using one of the following methods., (*2)

  • Clone yiisoft/yii2-coding-standards repository:
$ git clone git://github.com/yiisoft/yii2-coding-standards.git
  • Install composer.phar distribution:
$ curl -sS https://getcomposer.org/installer | php

Or if your system doesn't have CURL installed:, (*3)

$ php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
  • Set up all dependencies declared in composer.json:
$ php composer.phar install

PHP_Codesniffer

PHP_CodeSniffer coding standard, rule set and sniff token parsing classes for the Yii 2 Web Framework. Overally rules are based on PSR-12 standard with some minor exceptions and changes. Rules derived from PSR-12 standard and excluded in Yii2 standard were implemented (or planned to be) as sniff classes., (*4)

Rules could also be used for checking code style of an existing Yii2 applications., (*5)

Everything that is merged into main Yii2 development repository being checked with these rule set as well., (*6)

Using code style

After CodeSniffer is installed you can launch it with custom code style using the following syntax:, (*7)

$ ./vendor/bin/phpcs --extensions=php --standard=Yii2 /home/resurtm/work/Yii2MegaApp/

Installation can be also be done automatically with this tool:, (*8)

composer require --dev dealerdirect/phpcodesniffer-composer-installer

When using Composer 2.2 or higher, Composer will ask for your permission to allow this plugin to execute code. For this plugin to be functional, permission needs to be granted., (*9)

When permission has been granted, the following snippet will automatically be added to your composer.json file by Composer:, (*10)

{
    "config": {
        "allow-plugins": {
            "dealerdirect/phpcodesniffer-composer-installer": true
        }
    }
}

When using Composer < 2.2, you can add the permission flag ahead of the upgrade to Composer 2.2, by running:, (*11)

composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true

If you're using PhpStorm you can configure it to use CodeSniffer using Settings โ†’ PHP โ†’ Code Sniffer. Yii2 code style can be specified at Inspections โ†’ PHP โ†’ PHP Code Sniffer validation., (*12)

PhpStorm

Yii uses PSR-12 as code style standard. You can choose these via Settings โ†’ Code Style โ†’ PHP โ†’ Set from... โ†’ Predefined Style โ†’ PSR12., (*13)

ADDITIONAL NOTES

Feel free to request additional features, submit bugs and problems., (*14)

Thank you for choosing Yii Framework!, (*15)

The Versions

12/05 2017

dev-master

9999999-dev http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii

12/05 2017

2.0.3

2.0.3.0 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii

07/11 2016

2.0.2

2.0.2.0 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii

03/04 2015

2.0.1

2.0.1.0 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii

11/07 2014

2.0.0

2.0.0.0 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii

11/07 2014

2.0.0-rc

2.0.0.0-RC http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii