wpelevator/phpcs-parallel
Composer 安装命令:
composer require wpelevator/phpcs-parallel
包简介
Run PHPCS and PHPCBF across monorepos with isolated per-project configs, optionally in parallel.
README 文档
README
Run PHPCS once per project ruleset, optionally in parallel.
This is useful for monorepos where each package has its own phpcs.xml.dist. Instead of merging those rulesets into one PHPCS run, phpcs-parallel runs an isolated PHPCS process for each matched config.
Install
composer require --dev wpelevator/phpcs-parallel
Usage
Run PHPCS for every matched config:
vendor/bin/phpcs-parallel \
--config-pattern='packages/*/phpcs.xml.dist' \
--processes=4
Pass PHPCS options after --:
vendor/bin/phpcs-parallel \
--config-pattern='packages/*/phpcs.xml.dist' \
--processes=4 \
-- -s --report=summary
Run PHPCBF the same way:
vendor/bin/phpcbf-parallel \
--config-pattern='packages/*/phpcs.xml.dist' \
--processes=4
You can repeat --config-pattern or provide comma-separated patterns:
vendor/bin/phpcs-parallel \ --config-pattern='packages/*/phpcs.xml.dist' \ --config-pattern='apps/*/phpcs.xml.dist' vendor/bin/phpcs-parallel \ --config-pattern='packages/*/phpcs.xml.dist,apps/*/phpcs.xml.dist'
Each matched config runs as:
phpcs --standard=/path/to/package/phpcs.xml.dist /path/to/package
Config resolution
When project directories are provided explicitly, each directory uses the first config found in that directory, falling back to the nearest parent config. Config names are checked in this order:
.phpcs.xmlphpcs.xml.phpcs.xml.distphpcs.xml.dist
When no project directories are provided, the current working directory is recursively searched for matching config files. Passing both project directories and --config-pattern combines explicit projects with discovered projects and deduplicates them by project root.
Composer scripts
{
"scripts": {
"lint": "phpcs-parallel --config-pattern='packages/*/phpcs.xml.dist' --processes=4 -- -s",
"format": "phpcbf-parallel --config-pattern='packages/*/phpcs.xml.dist' --processes=4"
}
}
Development
Run the same checks used by CI:
composer lint
composer test
Run a specific test suite:
vendor/bin/phpunit --testsuite Unit vendor/bin/phpunit --testsuite Integration
Notes
- Dependency directories are skipped during discovery:
.git,vendor,node_modules,bower_components. - The wrapper returns the highest child exit code for PHPCS/PHPCBF lint/fix results. Runtime/tool errors are promoted to at least exit code
3. - Child process output is streamed through Symfony Console and prefixed with the project label.
- Use explicit project directories instead of patterns if needed:
vendor/bin/phpcs-parallel packages/foo packages/bar.
License
This project is open-sourced under the MIT License. See LICENSE for details.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-01