## About
PHP\_CodeSniffer is a set of two PHP scripts; the main `phpcs` script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second `phpcbf` script to automatically correct coding standard violations. PHP\_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.
[](https://travis-ci.org/squizlabs/PHP_CodeSniffer) [](http://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer) [](https://gitter.im/squizlabs/PHP_CodeSniffer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## Requirements
PHP\_CodeSniffer requires PHP version 5.4.0 or greater, although individual sniffs may have additional requirements such as external applications and scripts. See the [Configuration Options manual page](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options) for a list of these requirements.
## Installation
The easiest way to get started with PHP\_CodeSniffer is to download the Phar files for each of the commands:
```
# Download using curl
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
# Or download using wget
wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
wget https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
# Then test the downloaded PHARs
php phpcs.phar -h
php phpcbf.phar -h
```
### Composer
If you use Composer, you can install PHP_CodeSniffer system-wide with the following command:
composer global require "squizlabs/php_codesniffer=*"
Make sure you have the composer bin dir in your PATH. The default value is `~/.composer/vendor/bin/`, but you can check the value that you need to use by running `composer global config bin-dir --absolute`.
Or alternatively, include a dependency for `squizlabs/php_codesniffer` in your `composer.json` file. For example:
```json
{
"require-dev": {
"squizlabs/php_codesniffer": "3.*"
}
}
```
You will then be able to run PHP_CodeSniffer from the vendor bin directory:
./vendor/bin/phpcs -h
./vendor/bin/phpcbf -h
### Phive
If you use Phive, you can install PHP_CodeSniffer as a project tool using the following commands:
phive install phpcs
phive install phpcbf
You will then be able to run PHP_CodeSniffer from the tools directory:
./tools/phpcs -h
./tools/phpcbf -h
### PEAR
If you use PEAR, you can install PHP\_CodeSniffer using the PEAR installer. This will make the `phpcs` and `phpcbf` commands immediately available for use. To install PHP\_CodeSniffer using the PEAR installer, first ensure you have [installed PEAR](http://pear.php.net/manual/en/installation.getting.php) and then run the following command:
pear install PHP_CodeSniffer
### Git Clone
You can also download the PHP\_CodeSniffer source and run the `phpcs` and `phpcbf` commands directly from the Git clone:
git clone https://github.com/squizlabs/PHP_CodeSniffer.git
cd PHP_CodeSniffer
php bin/phpcs -h
php bin/phpcbf -h
## Documentation
The documentation for PHP\_CodeSniffer is available on the [Github wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki).
## Issues
Bug reports and feature requests can be submitted on the [Github Issue Tracker](https://github.com/squizlabs/PHP_CodeSniffer/issues).
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for information.
## Versioning
PHP_CodeSniffer uses a `MAJOR.MINOR.PATCH` version number format.
The `MAJOR` version is incremented when:
- backwards-incompatible changes are made to how the `phpcs` or `phpcbf` commands are used, or
- backwards-incompatible changes are made to the `ruleset.xml` format, or
- backwards-incompatible changes are made to the API used by sniff developers, or
- custom PHP_CodeSniffer token types are removed
The `MINOR` version is incremented when:
- new backwards-compatible features are added to the `phpcs` and `phpcbf` commands, or
- backwards-compatible changes are made to the `ruleset.xml` format, or
- backwards-compatible changes are made to the API used by sniff developers, or
- new sniffs are added to an included standard
> NOTE: Backwards-compatible changes to the API used by sniff develpers will allow an existing sniff to continue running without producing fatal errors but may not result in the sniff reporting the same errors as it did previously without changes being required.
The `PATCH` version is incremented when:
- backwards-compatible bug fixes are made
> NOTE: As PHP_CodeSniffer exists to report and fix issues, most bugs are the result of coding standard errors being incorrectly reported or coding standard errors not being reported when they should be. This means that the messages produced by PHP_CodeSniffer, and the fixes it makes, are likely to be different between PATCH versions.
没有合适的资源?快使用搜索试试~ 我知道了~
PHP-CodeSniffer-3.3.2 PHP代码规范检查工具
需积分: 0 1 下载量 178 浏览量
2022-12-02
23:30:35
上传
评论
收藏 584KB TGZ 举报
温馨提示
PHP_CodeSniffer是一款自动化的PHP代码规范检查工具。 CodeSniffer内置MySource、PEAR、PHPCS、PSR1、PSR2、Squiz和Zend等几套代码规范。当然,你也可以新增自己的代码规范。PHP_CodeSniffer包含两个工具,phpcs用来检查代码规范,phpcbf用来纠正代码规范。
资源推荐
资源详情
资源评论













格式:docx 资源大小:19.2KB


















收起资源包目录





































































































共 1138 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论


joshua317
- 粉丝: 109
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 大数据背景下的信息处理技术分析与研究.docx
- mssqlserver2000企业安装教程.doc
- 促进大数据发展行动纲要.doc
- 徐水职教中心计算机专业的教材建设及设计问题.docx
- 软件销售技巧销售话术.doc
- 软件测试技术基础CH.ppt
- 中小型餐厅无线监控网络一体化解决方案.doc
- 斜齿轮传动计算机辅助设计VB.doc
- 天津工程技术师范学院数控机床与编程试题库附答案.doc
- 基于百度文字识别 API 的身份证银行卡驾驶证行驶证快速识别工具
- 创新基金网络工作系统培训.docx
- 基于MATLAB的通信系统的方案设计书与仿真.doc
- 通信技术概论信号能量谱密度与功率谱密度.doc
- 大数据时代大学生思想政治教育探析.docx
- 计算机软件考试考生的报考动机研究.docx
- 电子商务(图书)微观环境研究分析.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
