Examples

Checks all files in the directory file matching the allowed file extension with the PEAR standard and prints the summary report without warnings.

<phpcodesniffer
  standard="PEAR"
  format="summary"
  file="/path/to/source-files"
  allowedFileExtensions="php php5 inc"/>

Checks all matching files in the fileset with the Zend standard, sets the zend_ca_path configuration which may be required by one of the sniffs, prints a list of used sniffs and prints the default report with warnings and the checkstyle report to /path/to/checkstyle.xml.

<phpcodesniffer
  standard="Zend"
  showSniffs="true"
  showWarnings="true">
  <fileset dir="/path/to/source-files">
    <include name="**/*.php"/>
  </fileset>
  <config name="zend_ca_path" value="/path/to/ZendStudio/bin/ZendCodeAnalyzer"/>
  <formatter type="default" usefile="false"/>
  <formatter type="checkstyle" outfile="/path/to/checkstyle.xml"/>
</phpcodesniffer>

Checks all files in the directory file with the PEAR standard and prints the checkstyle report without warnings. It also generates the documentation for the selected coding standard and writes it to the given file.

<phpcodesniffer
  standard="PEAR"
  file="/path/to/source-files"
  docGenerator="HTML"
  docFile="/path/to/doc.html">
  <formatter type="checkstyle" outfile="/path/to/checkstyle.xml"/>
</phpcodesniffer>