Download the PHP package stellarwp/nexcess-coding-standards without Composer
On this page you can find all versions of the php package stellarwp/nexcess-coding-standards. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stellarwp/nexcess-coding-standards
More information about stellarwp/nexcess-coding-standards
Files in stellarwp/nexcess-coding-standards
Package nexcess-coding-standards
Short Description Centralized coding standards for StellarWP packages
License MIT
Informations about the package nexcess-coding-standards
StellarWP Coding Standards
This package contains a base set of coding standards for StellarWP package development.
The rules are generally based on the PSR-12 coding standard, which is generally recommended within the larger PHP community.
Additionally, since StellarWP is largely-focused on WordPress, our standards also include important WordPress-oriented rules (e.g. late-escaping of output, input sanitization, nonce usage, etc.).
What's included?
There are two main tools included in this package:
PHP_CodeSniffer
PHP_CodeSniffer is the de-facto linting tool for PHP, and there are a number of pre-configured standards available.
This package includes PHP_CodeSniffer itself, along with the WordPress Coding Standards ruleset, PHP compatibility checks, and Dealerdirect's Composer installer for PHP_CodeSniffer.
PHP-CS-Fixer
PHP-CS-Fixer is an additional coding standards checker for PHP, maintained by several members of the Symfony team. It provides a bit more flexibility around more sophisticated checks and experiemental features.
Installation
This package should be installed as a development dependency for your project:
This will automatically expose the phpcs
, phpcbf
, and php-cs-fixer
binaries in your project's vendor/bin
directory.
You may also wish to add the following Composer scripts to make it easier to run checks:
Note: You may need to adjust paths to suit your project, especially if your Composer "vendor-dir" has been changed.
Project-specific configuration
The default coding standards make a few assumptions about the project (all of which may be overwritten on a per-project basis):
- Code should be compatible with PHP 5.6 or newer (to match WordPress' minimum requirements)
- Code should be compatible with the latest and previous major release WordPress (a.k.a. "current minus one")
- Anything passed through WordPress' internationalization (i18n) functions should use the "stellarwp" text domain
Rather than overwriting these values via command-line arguments, it's recommended to create a PHP_CodeSniffer configuration file in your project. An annotated starter configuration is included in this package, and can automatically be copied into the project root (.phpcs.xml.dist
) by running the following command:
Should you need to change the rules for PHP-CS-Fixer, you may publish a .php-cs-fixer.dist.php
file by running the following:
If you've copied the default test:standards
and test:standards-fix
scripts into your composer.json
file, please be sure to update their arguments!
License
This library is licensed under the terms of the MIT license.
All versions of nexcess-coding-standards with dependencies
dealerdirect/phpcodesniffer-composer-installer Version *
friendsofphp/php-cs-fixer Version ^3.5
phpcompatibility/phpcompatibility-wp Version ^2.1
wp-coding-standards/wpcs Version ^2.3