qualimetrix / qualimetrix
CLI tool for static analysis of PHP code - detects architectural mess and complexity issues
v0.27.0
2026-09-18 16:01 UTC
Requires
- php: ^8.4
- amphp/parallel: ^2.0
- nikic/php-parser: ^5.0
- psr/log: ^3.0
- symfony/config: ^7.4 || ^8.0
- symfony/console: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/expression-language: ^7.4 || ^8.0
- symfony/finder: ^7.4 || ^8.0
- symfony/yaml: ^7.4 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- justinrainbow/json-schema: ^6.6.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^12.0
Suggests
- ext-igbinary: For faster serialization in parallel processing
- ext-parallel: For true parallel processing with threads (alternative to ext-pcntl)
- ext-pcntl: Required for parallel processing on Unix (alternative to ext-parallel)
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v0.27.0
- v0.26.0
- v0.25.0
- v0.24.0
- v0.23.0
- v0.22.0
- v0.21.0
- v0.20.1
- v0.20.0
- v0.19.0
- v0.18.0
- v0.17.0
- v0.16.0
- v0.15.0
- v0.14.0
- v0.13.0
- v0.12.0
- v0.11.2
- v0.11.1
- v0.11.0
- v0.10.0
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.0
- v0.7.1
- v0.7.0
- v0.6.0
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.1
- v0.1.0
- dev-claude/rule-option-reader-census
- dev-x34-closure-package-removal
- dev-claude/beautiful-fermat-db614e
- dev-x31-closure-package-retirement
- dev-x32-retire-test-structure-records
- dev-x33-docker-default-command
- dev-release-0.27.0
- dev-html-report-package-hygiene
- dev-stage-05-content-defects
This package is auto-updated.
Last update: 2026-09-19 09:26:01 UTC
README
Static analysis tool for PHP code quality metrics.
Documentation | Quick Start | llms.txt
Features
- Complexity Metrics: Cyclomatic (CCN), Cognitive, NPATH
- Maintainability: Halstead metrics, Maintainability Index
- Coupling: RFC, Instability, Abstractness, Distance from Main Sequence
- Cohesion: TCC/LCC, LCOM4, WMC
- Size: LOC, Class/Method/Property Count
- Structure: DIT, NOC
- Architecture: Circular Dependency Detection, Layer Policy Enforcement
Quick Start
# Install composer require --dev qualimetrix/qualimetrix # Analyze bin/qmx check src/ # With specific format bin/qmx check src/ --format=json # Pre-commit hook bin/qmx hook:install
Output Formats
| Format | Use Case |
|---|---|
summary |
CLI, human-readable overview — the default |
text |
CLI, one line per finding |
json |
CI/CD integration |
metrics |
Raw metric values for every symbol |
health |
Health-score table with worst contributors |
html |
Interactive treemap report (-o report.html) |
checkstyle |
Jenkins, SonarQube |
sarif |
GitHub Security, VS Code |
gitlab |
GitLab Code Quality |
github |
GitHub Actions inline PR annotations |
suppressed |
Auditing what a run held back and why (--show-suppressed for a partial prose view) |
Configuration
Create qmx.yaml (full format):
rules: complexity.ccn: callable: warning: 15 error: 25
Or use CLI options:
bin/qmx check src/ --cyclomatic-warning=15 --cyclomatic-error=25
Git Integration
# Show violations in staged files only bin/qmx check src/ --report=git:staged # Show violations in changed files bin/qmx check src/ --report=git:main..HEAD
Baseline Support
# Generate baseline for existing violations bin/qmx baseline:generate baseline.json src/ # Use baseline bin/qmx check src/ --baseline=baseline.json
Documentation
- Quick Start
- Architecture
- Analysis capability index
- GitHub Action
- Changelog
- llms.txt — concise reference for AI agents
- llms-full.txt — complete documentation in a single file
Requirements
- PHP 8.4+
- Composer
Development
composer install composer test # Run tests composer phpstan # Static analysis composer check # Full validation
License
MIT