This is a WordPress project managed via Composer
This project serves as an example, and a baseline for Composer managed WordPress projects.
It's built using John P. Bloch's composer-ized WordPress mirror for the core; WordPress Packagist for registered WordPress plugins, and themes; and oomphinc/composer-installers-extender package for custom installation path support.
Besides the WordPress core, following also added as minimalist examples:
- Classic Editor plugin.
- cweagans/composer-patches to apply patches via Composer.
- PHP_CodeSniffer, and WordPress coding standards.
composer create-project gormus/wordpress your_folder
The first time this project is installed, WordPress coding standards are installed as well. They can also be installed via following command:
composer run-script install-codestandards
Try running ./vendor/bin/phpcs -i
to list all installed standards; following should be listed in the output:
WordPress, WordPress-Extra, WordPress-Docs and WordPress-Core.
The installed code sniffer, and standards can be used either via Composer, in shell scripts, or even in your favorite IDE. Here are a few examples:
Run PHP_CodeSniffer in current directory using WordPress standard:
composer run phpcs .
Fix wp-config.local.php file using WordPress standard:
composer run phpcbf wp-config.local.php
Configure Visual Studio Code and phpcs plugin to use WordPress standard
{
"phpcs.standard": "./vendor/wp-coding-standards/wpcs/WordPress/ruleset.xml"
}