dealerdirect/phpcodesniffer-composer-installer
Composer installer plugin that automatically discovers and installs PHP_CodeSniffer coding standards (rulesets) from Composer packages. It configures PHPCS installed_paths for you, avoiding manual symlinks and configuration. Supports PHPCS 3/4 and Composer 2.2+.
composer require --dev dealerdirect/phpcodesniffer-composer-installer:"^1.0"
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
wp-coding-standards/wpcs, phpcompatibility/php-compatibility, laravel/breeze’s bundled standards) in require-dev.composer install — standards are auto-registered with PHP_CodeSniffer; verify with:
./vendor/bin/phpcs -i
You should see your newly installed standards in the list.composer.json’s require-dev without manual installed_paths configuration.
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"wp-coding-standards/wpcs": "^3.0",
"phpcompatibility/php-compatibility": "^9.0"
}
"scripts": {
"post-install-cmd": [
"@install-codestandards"
],
"install-codestandards": [
"PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
]
}
Then call via composer install-codestandards.acme/phpcodesniffer-custom), declare "type": "phpcodesniffer-standard" and place standards in subdirectories ≤3 levels deep.composer.json can also require this plugin (using flexible version constraints like "*" or "^0.7 || ^1.0"), ensuring dependent standards auto-install for consumers.allow-plugins early (e.g., in Dockerfile or CI config) to avoid interactive prompts."extra": {
"phpcodesniffer-search-depth": 5
}
./vendor/bin/phpcs -i
./vendor/bin/phpcs -e -v # show installed rulesets + paths
composer.json includes:
"type": "phpcodesniffer-standard",
"require": {
"squizlabs/php_codesniffer": "^3.13 || ^4.0"
}
^1.0 while another package requires ^0.7). Use "*" or broad poly-fill constraints../vendor/bin/phpcs -i | grep -q 'YourStandardName' || exit 1
resources), ensure your vendor/ and node_modules/ are not interfering —PHPCS search depth only applies to Composer dependencies, not arbitrary folders.How can I help you explore Laravel packages today?