承接 nerones/codeigniter-phpcs 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nerones/codeigniter-phpcs

Composer 安装命令:

composer require nerones/codeigniter-phpcs

包简介

Rules for codeigniter

README 文档

README

Provides sniffs for PHP_CodeSniffer 1.3.0 and above to check CodeIgniter coding standard.

A bit of story

PHP_CodeSniffer

PHP_CodeSniffer is a PHP5 script that tokenises and "sniffs" PHP, JavaScript and CSS files to detect violations of a defined coding standard.

It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.

By default sniffs for a few coding convetions are provided like PEAR, Zend, PHPCS and Squiz. CodeIgniter-for-PHP_CodeSniffer is aimed at adding support for CodeIgniter coding convention.

CodeIgniter coding standard

CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications.

CodeIgniter is developed by EllisLab. The compagny follows some specific coding rules for their developments and for CodeIgniter especially.

Based on PHP_CodeSniffer CodeIgniter-for-PHP_CodeSniffer helps to validate most of the rules in CodeIgniter coding standard.

Installation

With composer

Add this to your composer.json

{
 "require-dev": {
   ...
   "nerones/codeigniter-phpcs": "dev-master"
   ...
 },
}

then run composer install and after that, you can use this set of rules like:

vendor/bin/phpcs --standard=vendor/nerones/codeigniter-phpcs/CodeIgniter/ --extensions=php src/

The paths used needs to be changed if you install the ruleset globaly.

With ant

There is an Apache Ant script at the root of the repository. It targets standard Linux environment like Ubuntu with PHP_CodeSniffer 1.3.0 or above installed via PEAR. It requires PHP (in its 5th version).

Just go to the root of the project and type ant to set up CodeIgniter-for-PHP_CodeSniffer. If you have CodeSniffer installed in another directory than "/usr/share/php/PHP/CodeSniffer/" than you can pass the right directory as argument to ant. Just type ant -Dphpcs.dir="/path/to/CodeSniffer/".

Check that it is installed type phpcs -i you should see a list of installed standards.

Then you can go to you project folder and run phpcs --standard=CodeIgniter my-file-or-my-directory.php.

If you work on a Windows platform or for any reason, it is easy to edit the installation script. You just need to change the property phpcs.dir in build.xml to point toward the directory containing PHP_CodeSniffer.

统计信息

  • 总下载量: 6.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 53
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-13