Skip to content

Install PHPCS at the project level

Installing PHPCS at the project level limits the availability of PHPCS to only from within that project directory. Following these instructions will install:

Note

PHPCS commands on a local machine running Windows may require different formatting than the command examples shown below.

Install

In the local machine’s terminal:

  1. Before beginning installation, ensure that Composer itself is up to date:
composer self-update && composer global update
  1. Navigate (cd) to the root of the project.
  2. Run the following command to add or update composer.json and composer.lock files and a vendor/ directory (the vendor/ directory can optionally be ignored in version control):
composer require --dev automattic/vipwpcs

Command formatting

When PHPCS is installed locally (at the project level), it will be necessary to format the commands shown below directly referencing the executable at vendor/bin/phpcs instead of phpcs.

For example, this command:

phpcs -i

should instead be formatted as:

vendor/bin/phpcs -i

Last updated: December 23, 2023

Relevant to

  • WordPress