WP Engine Coding Standards (WPECS) uses Composer to install these main dependencies:
If you're using Homebrew on Mac, you can install Composer with: brew install composer. Otherwise, follow the
official installation instructions for Composer.
- Clone the repository and install the dependencies:
git clone git@github.com:newscorp-ghfb/dj-wp-phpcs-ruleset.git
cd dj-wp-phpcs-ruleset
composer install- Link your coding standards to your
phpcsinstallation:
phpcs --config-set installed_paths /path/to/dj-wp-phpcs-rulesetYou can also install the coding standards as a dependency in your local project. Here's how
- Add the following repository to your composer.json
{
"repositories": [
{
"type": "git",
"url": "git@github.com:newscorp-ghfb/dj-wp-phpcs-ruleset.git"
}
]
}- Manually add the following to
require-devin composer.json
{
"newscorp/dj-wp-phpcs-ruleset": "dev-master"
}-
Run
composer installorcomposer updateto ensure your project is configured. -
You can now use
DJ-WordPress-CMSin any IDE that uses the local phpcs. If you already have a phpcs.xml in your project, simply add the following to it:
<rule ref="DJ-WordPress-CMS"/>Run the phpcs command line tool on a given file or directory, for example:
phpcs --standard=DJ-WordPress-CMS wp-load.php