Using PHP_CodeSniffer

INSTALLATION
There’s many ways to install PHP_CodeSniffer.
You could try (on debian-base) apt-get install php-codesniffer – or if you have pear installed you could try pear install PHP_CodeSniffer. Or lastly, the way I like to do it, manually.

I like to perform a manual installation on tools like this so I know where to find them and manipulate them in the future.

Manual install:


Next, you need to replace the php_bin path in the phpcs file with the path to the php binary:

Test it out with:
./phpcs /path/to/some/phpfile.php

Now to finalize the install, there’s many places you could place the binary, I personally prefer to camp the working files like this in /usr/local/bin

Leave a Reply

Your email address will not be published. Required fields are marked *