服务端部署:PHP_CodeSniffer HG 服务端部署篇
1.下载PHP_CodeSniffer
前往 https://github.com/squizlabs/PHP_CodeSniffer 下载最新版本包,解压到你想放置的目录。
2.以这个文件[ PHP_CodeSniffer/blob/master/scripts/phpcs.bat ]为检测入口,配置IDE。
3.命令行检测: /usr/bin/php /home/hg/php_codesniffer/scripts/phpcs --standard=PHPCS --tab-width=4 /tmp/php_source/
分割线
========================================================================================================================================
一、安装composer
打开CMD命令窗口:
mkdir D:\wamp\bin\php\composer
cd D:\wamp\bin\php\composer
php -r "readfile('http://install.phpcomposer.com/installer');" | php echo @php "%~dp0composer.phar" %*>composer.bat
上述命令执行成功之后再将 D:\wamp\bin\php\composer 路径加入 PATH
环境变量即可。最后重新打开一个命令行窗口试一试执行 composer --version
看看是否正确输出版本号。
例如:
Composer version 1.0-dev (72cd6afdfce16f36a9fd786bc1b2f32b851e764f) 2015-12-28 17:35:19
进入你的项目的根目录(也就是composer.json
文件所在目录),执行如下命令生成composer.json:
composer init
添加中国Packagist 镜像源:
composer config -g repo.packagist composer http://packagist.phpcomposer.com
成功执行结果后,composer.json文件内容如下:
{
"name": "vendor_name/package_name",
"description": "description_text",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "author's name",
"email": "email@example.com"
}
],
"repositories": {
"packagist": {
"type": "composer",
"url": "http://packagist.phpcomposer.com"
}
}
}
OK,一切搞定!试一下 composer install
来体验飞一般的速度吧!
二、安装squizlabs/php_codesniffer ,drupal/coder
composer require squizlabs/php_codesniffer
composer require drupal/coder
该命令会自动下载最新的可用package包版本。
三、配置phpstorm
以上配置基本OK了,现在打开一个php文件看效果吧!
四、配置netbeans
以上配置基本OK了,现在打开一个php文件:
PS:
http://kybest.hu/en/blog/using-php-codesniffer-in-phpstorm
http://pkg.phpcomposer.com
http://www.111cn.net/phper/linux-php/70174.htm
http://bbs.lampbrother.net/read-htm-tid-152445.html