webprofil/coding-standards
Composer 安装命令:
composer require webprofil/coding-standards
包简介
Zero-configuration QA toolchain for WEBprofil TYPO3 projects – scaffolds Rector, Fractor, PHP-CS-Fixer, PHPStan configs with dynamic version detection and CLI-driven execution.
README 文档
README
Zero-configuration QA toolchain for WEBprofil TYPO3 projects. Provides a unified CLI (webprofil-qa) and Composer plugin that scaffolds Rector, Fractor, PHP-CS-Fixer, and PHPStan configurations under build/qa/, with dynamic PHP and TYPO3 version detection.
Features
- CLI-driven QA – run all checks and fixers via a single
webprofil-qacommand with subcommands for each tool - Composer plugin – auto-scaffolds config files on install/update (no script injection)
- Configuration factories – centralized, dynamic configs for Rector, Fractor, PHP-CS-Fixer, and PHPStan
- Dynamic version detection – reads
composer.json(platform PHP) andcomposer.lock(TYPO3 core major) to apply the correct level sets - Cache isolation – all tool caches are stored in
build/qa/.cache/and ignored via.gitignore - Graceful cleanup – uninstalling the package removes only scripts/descriptions that still match the injected values
- Non-destructive scaffolding – existing config files in
build/qa/are never overwritten
Installation
composer require --dev webprofil/coding-standards
Before installing, the host project must allow the Composer plugin either by accepting Composer's interactive prompt or by pre-configuring:
"config": {
"allow-plugins": {
"webprofil/coding-standards": true
}
}
After installation, the plugin will automatically:
- Create
build/qa/with configuration files for all four tools (if they don't already exist) - Create the
vendor/bin/webprofil-qabinary for CLI usage
Usage
Run the full QA pipeline:
vendor/bin/webprofil-qa check
Auto-fix all fixable issues:
vendor/bin/webprofil-qa fix
Scaffold missing configuration files:
vendor/bin/webprofil-qa install
Verify that all required files and binaries are present:
vendor/bin/webprofil-qa doctor
Show help and command-specific examples:
vendor/bin/webprofil-qa list
vendor/bin/webprofil-qa --help
vendor/bin/webprofil-qa help cs
Command reference
| Command | Description |
|---|---|
webprofil-qa / list / --help | Show help and available commands |
webprofil-qa check | Run all checks (cs, stan, rector, fractor) |
webprofil-qa fix | Run all fixers (cs, rector, fractor) |
webprofil-qa cs check | Check PHP coding style (dry-run) |
webprofil-qa cs fix | Fix PHP coding style |
webprofil-qa stan check | Run PHPStan static analysis |
webprofil-qa rector check | Dry run Rector upgrades |
webprofil-qa rector fix | Apply Rector upgrades |
webprofil-qa fractor check | Dry run Fractor upgrades |
webprofil-qa fractor fix | Apply Fractor upgrades |
webprofil-qa install | Scaffold missing build/qa/ config files |
webprofil-qa doctor | Check required files and binaries |
Legacy Composer scripts (removed)
Previous versions of this package injected Composer scripts (composer qa, composer cs:check, etc.).
As of v2, the package no longer injects Composer scripts. Use the webprofil-qa CLI instead.
If old scripts are still present in your composer.json, the plugin removes them on uninstall.
Configuration
Dynamic version detection
The plugin automatically detects:
- PHP version – from
config.platform.php(first), thenrequire.php, thenrequire-dev.phpincomposer.json - TYPO3 major version – from
typo3/cms-coreversion incomposer.lock(packages then packages-dev), falling back to the constraint incomposer.json
Rector and Fractor use the detected versions to apply the appropriate LevelSetList (e.g. UP_TO_PHP_84, UP_TO_TYPO3_14).
Customizing configs
All scaffolded files include centralized config files from vendor/webprofil/coding-standards/ and contain commented-out customization examples. Since the plugin never overwrites existing files, your changes persist across package updates.
Rector – edit build/qa/rector.php:
$config = RectorConfigFactory::create(__DIR__ . '/../..');
$config->withSkip([
__DIR__ . '/../../extensions/legacy/Classes',
]);
PHP-CS-Fixer – edit build/qa/.php-cs-fixer.php:
$config = ConfigFactory::create(__DIR__ . '/../..');
$config->addRules([
'no_unused_imports' => false,
]);
PHPStan – edit build/qa/phpstan.neon:
The scaffolded PHPStan config includes the centralized package config from webprofil/coding-standards and only keeps project-specific paths locally.
The package default level is 5.
parameters:
level: 8
excludePaths:
- ../../extensions/legacy/*
Path detection
The PathDetector service scans for existing directories in this order:
extensions/<name>/{Classes,Configuration,Tests,Resources}– for each extension directorypackages/<name>/{Classes,Configuration,Tests,Resources}– for each package directory- Project root directories:
src/,tests/,Classes/,Configuration/
Different tools get different path sets:
- Rector: Classes, Configuration, Tests, and entry point files
- Fractor: Configuration, Resources (TypoScript/XML focus)
- PHPStan: Classes, Tests
- PHP-CS-Fixer: Full extension directories + src, tests
Uninstall
composer remove webprofil/coding-standards
Upon uninstallation, the plugin removes only the Composer scripts and descriptions it originally injected, provided they still match the original values. If you customized a script, it is left in place to avoid breaking your project.
Scaffolded files under build/qa/ are not removed — they remain available for manual use.
Requirements
- PHP >= 8.2
- Composer 2.x
- TYPO3 v12+ (v13 default fallback, v12 when detected from lock/constraint)
License
GPL-2.0-or-later
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-06-18