PHPCompatibilityWP coding standard is not installed

Advertisement

How to Check PHPCompatibilityWP exist?

To check the PHPCompatibilityWP coding standard is installed on your system use command phpcs -i

E.g.

phpcs -i

You can see the result like below:

The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs, WordPress-Extra and PHPCompatibility

Maybe you have some additional coding standards install on your system or a few above. But note that the PHPCompatibilityWP is not exist.

How to Install PHPCompatibilityWP?

Now to install the PHPCompatibilityWP goto your composer setup which found in the location C:\Users\USER\AppData\Roaming\Composer.

Note: Here USER is your own user name.

  • Open Terminal/Command Prompt
  • Type cd C:\Users\USER\AppData\Roaming\Composer
  • and type below command:
composer require --dev phpcompatibility/phpcompatibility-wp:*

After executing the above command you can see something like:

C:\Users\USER\AppData\Roaming\Composer
λ composer require --dev phpcompatibility/phpcompatibility-wp:*
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing phpcompatibility/phpcompatibility-paragonie (1.3.0): Loading from cache
  - Installing phpcompatibility/phpcompatibility-wp (2.1.0): Loading from cache
phpcompatibility/phpcompatibility-paragonie suggests installing roave/security-advisories (dev-master || Helps prevent installing dependencies with known security issues.)
phpcompatibility/phpcompatibility-wp suggests installing roave/security-advisories (dev-master || Helps prevent installing dependencies with known security issues.)
Writing lock file
Generating autoload files
PHP CodeSniffer Config installed_paths set to ../../phpcompatibility/php-compatibility,../../phpcompatibility/phpcompatibility-paragonie,../../phpcompatibility/phpcompatibility-wp,../../wp-coding-standards/wpcs 

And then

composer install

After executing the above command you can see something like below:

C:\Users\USER\AppData\Roaming\Composer
λ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
PHP CodeSniffer Config installed_paths set to ../../phpcompatibility/phpcompatibility-paragonie,../../phpcompatibility/phpcompatibility-wp,../../wp-coding-standards/wpcs,../../phpcompatibility/php-compatibility

Great! you have successfully installed the PHPCompatibilityWP on your system.

How to confirm the PHPCompatibilityWP is installed?

To confirm the PHPCompatibilityWP is successfully installed on your system.

Use the same command which we have recently used that is phpcs -i.

E.g.

phpcs -i

After using it you can see the message something lie below:

The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz, Zend, PHPCompatibilityParagonieRandomCompat, PHPCompatibilityParagonieSodiumCompat, PHPCompatibilityWP, WordPress, WordPress-Core, Wor
dPress-Docs, WordPress-Extra and PHPCompatibility

Now you can see the coding standard is now installed on your system.

Happy Coding!

%d bloggers like this: