5 commands to be a better PHP developer
Following commands will add you the CodeSniffer pear package and set it to check for the PSR standards before committing anything to your git repository. No need to what the previous acronyms are about (expect pear and git :) ).
Just do the following:
# pear install PHP_CodeSniffer
# cd /usr/share/pear/PHP/CodeSniffer/Standards/
# git clone http://github.com/klaussilveira/phpcs-psr PSR
Note: The CodeSniffer directory may vary for your system.
$ cd /path/to/your/project/.git/hooks/
$ wget http://raw.github.com/dmtrs/git-hooks/master/phpcs-pre-commit/pre-commit
Written by Dimitrios Meggidis
Related protips
3 Responses
optimum
over 1 year ago
·
You need to mark the pre-commit hook as executable if you want git to invoke it.
chmod +x pre-commit
over 1 year ago
·
Since of PHP_CodeSniffer 1.4.x PSR is distributed with phpcs - so no need for an extra download.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#