blogprogramming

Install PHP Code Sniffer (phpcs)

PHP CodeSniffer, aka phpcs, helps you in detecting violations in your PHP code. Violations can be:

  • opening curly brackets in the wrong place (on a new line, or vice versa)
  • indentation
  • use of upper- or lowercase variable/function/method/class names
  • missing phpdoc blocks for files, classes or functions
  • your own coding standards
  • etc.

Before installing PHP CodeSniffer with PEAR, you actually need to install PEAR.

Installing PHP CodeSniffer is as simple as:

$ sudo pear install PHP_CodeSniffer

Check out the manual for more information: http://pear.php.net/manual/en/package.php.php-codesniffer.php

What now?

  • Use PHP Code Sniffer with PHPStorm IDE
  • Use PHP Code Sniffer with your Continuous Integration like Jenkins
0 Shares

Leave a Reply

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