bigwing / phpcs-composer
Installs: 38
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:phpcodesniffer-standard
Requires
- php: >=5.6.0,<8.0.0-dev
- dealerdirect/phpcodesniffer-composer-installer: *
- phpcompatibility/phpcompatibility-wp: *
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: ^3.4.0
- wp-coding-standards/wpcs: ^2.3
This package is auto-updated.
Last update: 2025-03-08 04:59:25 UTC
README
Composer library to provide drop in installation and configuration of WPCS and PHPCompatibilityWP, setting reasonable defaults for WordPress development with nearly zero configuration.
Installation
Install the library via Composer:
$ composer require --dev bigwing/phpcs-composer:dev-master
That's it!
Usage
Lint your PHP files with the following command:
$ ./vendor/bin/phpcs .
If relying on Composer, edited the composer.json
file by adding the following:
"scripts": { "lint": [ "phpcs . --standard=BigWing-WP" ], }
Then lint via:
$ composer run lint
Continuous Integration
PHPCS Configuration plays nicely with Continuous Integration solutions. Out of the box, the library loads the BigWing-WP
ruleset, and checks for syntax errors for PHP 7.2 or higher.
To override the default PHP version check, set the --runtime-set testVersion 7.2-
configuration option. Example for PHP version 7.4 and above:
$ ./vendor/bin/phpcs --runtime-set testVersion 7.4-
See more information about specifying PHP version.
Note that you can only overrule PHP version check from the command-line.
IDE Integration
Some IDE integrations of PHPCS fail to register the BigWing-WP
ruleset. In order to rectify this, place .phpcs.xml.dist
at your project root:
<?xml version="1.0"?> <ruleset name="Project Rules"> <rule ref="BigWing-WP" /> </ruleset>
Support Level
Internal: BigWing is working on this for internal projects, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.
Thanks and Credits
- 10up for their PHPCS ruleset that this is based on.
- The WordPress Coding Standards contributors for laying the groundwork for standardized code sniffing in WordPress.