ardem/yii-coding-standard
Composer 安装命令:
composer require ardem/yii-coding-standard
包简介
Yii Framework PHP CodeSniffer Coding Standard.
README 文档
README
You can read about Yii standard here: https://github.com/yiisoft/yii/wiki/Core-framework-code-style
How to install
-
Install PEAR:
http://pear.php.net/manual/en/installation.getting.php -
Install PHP_CodeSniffer:
pear install PHP_CodeSniffer -
Install Yii Coding Standard:
git clone git://github.com/Ardem/yii-coding-standard.git Yii sudo ln -sv /path/to/yii-coding-standard/Yii $(pear config-get php_dir)/PHP/CodeSniffer/Standards -
If you want, you can set Yii as coding standard by default:
phpcs --config-set default_standard Yii
How to make a simple test
-
Checking a file (if yii-coding-standard is your standard by default)
phpcs path/to/file.php -
Checking a file (if yii-coding-standard is NOT your standard by default)
phpcs --standard=Yii /path/to/file.php -
Checking a directory (if yii-coding-standard is your standard by default)
phpcs /path/to/directory -
Checking a directory (if yii-coding-standard is NOT your standard by default)
phpcs --standard=Yii /path/to/directory
How to use CS in IDE
-
NetBeans:
http://plugins.netbeans.org/plugin/40282/phpmd-php-codesniffer-plugin -
PHPStorm
http://www.jetbrains.com/phpstorm/webhelp/using-php-code-sniffer-tool.html -
Zend Studio
http://files.zend.com/help/Zend-Studio/content/working_with_php_codesniffer.htm
How to make a standard coding in the team
Use pre-commit hooks, which will make a code standard check for every commit.
-
For Git
http://git-scm.com/book/en/Customizing-Git-Git-Hooks -
For SVN
http://pear.php.net/manual/ru/package.php.php-codesniffer.svn-pre-commit.php
Yii-coding-standard and Composer
For using "yii-coding-standard" with Composer, include a dependency for "ardem/yii-coding-standard" in your composer.json file:
{
"require": {
"ardem/yii-coding-standard": "dev-master"
}
}
统计信息
- 总下载量: 5.95k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 37
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2013-06-10