Skip to content

Requirements

github-actions[bot] edited this page Mar 23, 2026 · 13 revisions

PHP_CodeSniffer 4.x requires PHP 7.2.0 or greater.
Prior to PHP_CodeSniffer 4.0.0, the minimum PHP requirement was 5.4.0.

Additionally, PHP_CodeSniffer requires the following PHP extensions to be enabled:

  • Tokenizer: used by the core tokenizer to process PHP files
  • SimpleXML: used to process ruleset XML files
  • XMLWriter: used to create some report formats
  • libxml: required by the SimpleXML and XMLWriter extensions

The following PHP extensions are not required, but are strongly recommended:

  • DOM: used for displaying the sniff documentation via the --generator=... option.
  • iconv: used for accurate character length calculation in files containing multibyte characters.
    Without this extension, some sniffs, like Generic.Files.LineLength, may report incorrect results for lines containing non-ASCII characters, as PHP_CodeSniffer will fall back to byte-based length calculations.
    Additionally, the following reports will not work without this extension if the project encoding is not UTF-8: Checkstyle, JUnit and XML.
  • json: required for the cache functionality, as well as for the JSON report output.
  • PCNTL: required for parallel processing via the --parallel CLI option.
    Without this extension, PHP_CodeSniffer will not be able to check multiple files simultaneously.

Individual sniffs may have additional requirements such as external applications and scripts. See the Configuration Options manual page for a list of these requirements.

Warning

The gRPC PHP extension is known to cause PHP_CodeSniffer to hang when running with parallel processing enabled. If the gRPC extension is loaded, either do not use the --parallel CLI option or configure the extension's ini settings as follows:

phpcs -d grpc.enable_fork_support=1 -d grpc.poll_strategy=epoll1 [other options] <file|directory>

Clone this wiki locally