Debug php in vim, install phpcode_sniffer, php-md.phpqa.vim1: install phpcodesniffer and phpmphpcodesniffera: centos Series & nbsp; # yuminstallphp-pear # yuminstallImag Debug php in vim, install php code_sniffer, php-md. phpqa. vim
1: install php code sniffer and php md
Php code sniffer
A: For centos
# Yum install php-pear
# Yum install ImageMagick-devel
# Pear install PHP_CodeSniffer
# Pear channel-discover pear.phpm.org
# Pear channel-discover pear.pdepend.org
# Pear install -- alldeps phpmd/PHP_PMD
Modify the php. ini file and add extension = imagick. so.
Debian
# Apt-get install php-pear
# Apt-get install php5-imagick imagemagick.
Later than centos above,
You just don't need to modify php. ini to add the imagick extension.
2: vim
:! Php-l % This is to check the syntax parameters of the current php file
: Phpcs. this is code sniffer.
: Phpmd: this is the mess detector. you need an XML rule file if it is not set.
: Phpcc: the display code coverage. you also need an XML rule file if it is not set.
3: install phpqa. vim
Https://github.com/rainysia/vimrc/commits/master
Clone the file and save it to $ ~. In vim, note that. vim under user
Add in. vimrc
let g:phpqa_codesniffer_args = "--standard=Zend"let g:phpqa_codesniffer_cmd = '/usr/bin/phpcs' let g:phpqa_codesniffer_autorun = 1 " default =1 on savelet g:phpqa_messdetector_ruleset = ''let g:phpqa_messdetector_cmd = '/usr/bin/phpmd'let g:phpqa_messdetector_autorun = 0
Cmd is the path of the type after the first step of installation,
# Type phpcs
/Usr/bin/phpcs
Autorun = 1 is automatically enabled. when you save it, the system will automatically run the prompt.
Sebastian Bergmann's ruleset
Run the test now and open the vim input. Then, w is saved, and an error is prompted, indicating that php cannot be closed. it seems that the syntax requirements are very strict. remove?> Then save it and there will be no error message.
For more information, see-h in shell.
Reference URL
Http://phpmd.org/download/index.html installation phpmd
Http://pear.php.net/package/PHP_CodeSniffer/redirected php code sniffer
Use of http://blog.csdn.net/xinhaozheng/article/details/3324796 php code sniffer
Use of http://developer.51cto.com/art/201105/261292.htm php mess detor
Xml declaration for http://coreymaynard.com/blog/finding-what-stinks-and-cleaning-up-the-mess/
Http://joncairns.com/2012/05/using-vim-as-a-php-ide/#comment-133 phpqa article
Https://github.com/joonty/vim-phpqa or phpqa