Skip to content

Instantly share code, notes, and snippets.

@contactjavas
Last active October 9, 2023 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save contactjavas/9383f881eed45bdcc7106f2b4e15c710 to your computer and use it in GitHub Desktop.
Save contactjavas/9383f881eed45bdcc7106f2b4e15c710 to your computer and use it in GitHub Desktop.
Install phpcs (PHP_CodeSniffer) + wpcs (WordPress Coding Standards) on Windows

Setup CLI

Install PHPCS via Composer

composer global require "squizlabs/php_codesniffer=*"

Install WPCS via Composer

composer global require "wp-coding-standards/wpcs"

Add WPCS to PHPCS

phpcs --config-set installed_paths %APPDATA%\Composer\vendor\wp-coding-standards\wpcs

Check it!

phpcs -i

Setup Editor

VSCode

  • If you haven't installed phpcs (PHP CodeSniffer for Visual Studio Code) by Ioannis Kappas, please install it.
  • You can do it by pressing Ctrl Shift X and search for phpcs and then press Install.

Atom

  • If you haven't installed linter-phpcs (Lint PHP on the fly, using phpcs) by AtomLinter, please install it.
  • You can do it by pressing Ctrl , then click Install. Search for linter-phpcs and then press Install.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment