Facebook Google+ Twitter

WebCodeSniffer is a web version of PHP_CodeSniffer. It allows you to use easely PHP_CodeSniffer in your browser on a local or remote server. No PEAR, no CLI needed. This tool will help you to follow guidelines when coding in order to reduce bugs, prevent new bugs and have a code clean, consistent and easy to read and maintain.


About

About PHP_CodeSniffer

"PHP_CodeSniffer is a PHP5 script that tokenises PHP, JavaScript and CSS files to detect violations of a defined set of coding standards. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers".
PHP_CodeSniffer on PEARPHP_CodeSniffer on GitHub
PHP_CodeSniffer blog

About Coding Standards / Coding Conventions

"Coding conventions are a set of guidelines for a specific programming language that recommend programming style, practices and methods for each aspect of a piece program written in this language. These conventions usually cover file organization, indentation, comments, declarations, statements, white space, naming conventions, programming practices, programming principles, programming rules of thumb, etc. Software programmers are highly recommended to follow these guidelines to help improve the readability of their source code and make software maintenance easier."
read morePEAR Coding StandardsPHP The Right Way


Server Version

How to install

  • Download WebcodeSniffer
  • Unzip webcodesniffer.zip
  • Copy the folder 'webcodesniffer' at the root of your server or web host
  • Open /webcodesniffer/index.php
  • Navigate / sniff a file
  • Clean up your code...

Download

Download WebCodeSniffer

WebCodeSniffer 0.2

based on PHP_CodeSniffer 1.3.5

Download WebCodeSniffer

WebCodeSniffer for EasyPHP (WAMP server)

soon Module ready-to-use for EasyPHP
see website

Standards included :

  • PHPCS
  • PEAR
  • Squiz
  • Zend
  • PSR1
  • PSR2
  • Generic
  • MySource
  • Joomla
  • Drupal
  • CakePHP

Online Version beta

Use this code as an example or paste your own code.

Select a standard and click on 'sniff'.
Standard:

Example of report:

-----------------------------------------------------------
FOUND 8 ERROR(S) AND 3 WARNING(S) AFFECTING 7 LINE(S)
-----------------------------------------------------------
  1 | ERROR   | End of line character is invalid; expected 
    |         | "\n" but found "\r\n"
  5 | ERROR   | There must be exactly one blank line before
    |         | the tags in file comment
  5 | ERROR   | @author tag comment indented incorrectly;
    |         | expected 2 spaces but found 3
  6 | ERROR   | @license tag comment indented incorrectly;
    |         | expected 1 spaces but found 2
  7 | WARNING | Invalid version "5.4.x" in file comment;
    |         | consider "CVS: " or "SVN: " or "GIT: "
    |         | instead
  7 | ERROR   | @version tag comment indented incorrectly;
    |         | expected 1 spaces but found 2
  8 | ERROR   | @link tag comment indented incorrectly;
    |         | expected 4 spaces but found 5
  9 | WARNING | PHP version not specified
  9 | ERROR   | Missing @category tag in file comment
  9 | ERROR   | Missing @package tag in file comment
 11 | WARNING | Inline control structures are discouraged
-----------------------------------------------------------

Screenshots

Server Version

Screenshot WebCodeSniffer - Server Version Screenshot WebCodeSniffer - Server Version

Online Version

soon