views:

43

answers:

2

I have a PHP library that I'm planning to submit to the PEAR database. In order to do this, the library needs to follow the PEAR Coding Standards.

Is there a tool that can check my code to make sure it follows the standards completely?

+5  A: 

http://pear.php.net/manual/en/package.php.php-codesniffer.php

By default, PHP_CodeSniffer will use the PEAR coding standard if no standard is supplied on the command line.

B00MER
**Aha!** Perfect.
George Edison
A: 

As B00MER mentioned, PHP_CodeSniffer defaults to using the PEAR coding standard, if you don't specify a different one. But you can change what it defaults to - handy if you have an in-house standard (which isn't really a standard then, but anyway) or prefer one of the other standards that ships with PHP_CodeSniffer and don't want to keep specifying them with the --standard argument.

To get a list of what Standards are available to choose from, do this:

$ phpcs -i

And to change the default to Zend:

$ sudo phpcs --config-set default_standard Zend

If you want to check what the default is:

$ phpcs --config-show
kguest