Library for calculating the complexity of PHP code units
1.3k
Stars
10
Forks
2
Open issues
5
Contributors
AI Analysis
Library for calculating cyclomatic complexity of PHP code units. It serves specialized static analysis workflows where developers need to measure code complexity programmatically as part of their quality gates and metrics pipelines. Best suited for PHP developers building linting tools, CI/CD integrations, or architectural analysis systems—not a general-purpose utility.
Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.
AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.
Specialized PHP code complexity calculator used within PHPUnit ecosystem
sebastian/complexity is a focused PHP library for calculating cyclomatic and cognitive complexity metrics of code units. Built and maintained by Sebastian Bergmann (PHPUnit creator), it appears designed as a dependency for code quality tooling rather than as a standalone user-facing product. No README documentation of real adoption exists beyond ecosystem integration signals.
Created July 2020 as part of Bergmann's suite of PHP code analysis libraries. Follows the modular architecture pattern established by his earlier work (php-code-coverage, lines-of-code, comparator), each addressing a discrete analysis concern rather than competing with monolithic tools.
Repository shows stable but minimal growth (1,261 stars, 10 forks as of July 2026). Last push occurred 2026-07-08, indicating continuous maintenance. Growth trajectory appears flat, consistent with a utility library serving as a transitive dependency rather than a primary user tool. No viral adoption pattern observed.
Adoption not verified. README contains only installation instructions and project description; no documentation of known users, integrations, or deployment contexts. Presence in Packagist and CI badges indicate it is packaged for distribution, but actual production usage cannot be confirmed from available metadata.
README does not document internal architecture, API design, or supported complexity metrics (cyclomatic, cognitive, etc.). Appears to be a single-purpose analyzer likely parsing PHP AST, but implementation details not visible from provided documentation.
README includes codecov badge linking to coverage metrics, suggesting test infrastructure exists, but specific coverage percentage not stated in provided excerpt.
Last push 2026-07-08 (within 24 hours of analysis date) signals active maintenance. Repository shows CI/CD workflow badges and consistent recent activity, indicating ongoing support rather than abandonment. Maintenance appears reactive to dependencies and bug fixes rather than feature-driven.
ADOPT IF: building code quality tooling in PHP and need pluggable, focused complexity metrics library; already depend on Bergmann's ecosystem. AVOID IF: seeking an end-user tool for code analysis — use PHPMetrics or integrated IDE features instead; or if primary need is comprehensive analysis beyond complexity. MONITOR IF: maintaining PHP code quality infrastructure; watch whether this library is adopted by broader ecosystem tools and whether metric definitions evolve.
Independent dimensions
Mainstream potential
2/10
Technical importance
5/10
Adoption evidence
2/10
- Adoption not publicly documented — unclear if library is actively used downstream or primarily maintained for historical reasons.
- Narrow scope may limit growth to specialized tooling use cases; not designed for general PHP developer workflow.
- Dependency on PHP AST parsing means changes to PHP language features or parsing libraries could require updates.
- Low star count relative to sibling projects (lines-of-code, environment) suggests this particular metric (complexity) may be less valued than code coverage or line counts.
- No visible evidence of community contribution or ecosystem integration beyond Packagist; bus factor appears concentrated on original author.
Library will likely remain a stable, slowly-maintained utility for PHP tooling authors rather than grow mainstream adoption. May see modest usage increase only if broader quality-scanning tools integrate it, but absence of documented integrations suggests this is not occurring rapidly.
Newsletter
Get analyses like this every Monday
Free weekly digest of the most interesting open-source discoveries.
Languages
Information
- Language
- PHP
- License
- BSD-3-Clause
- Last updated
- 2d ago
- Created
- 73mo ago
- Analyzed with
- anthropic/claude-haiku-4-5
Stars over time
Contributors over time
Top 100 contributors only — repos with more will plateau at 100.
Open issues
Open pull requests
Top contributors
Similar repos
sebastianbergmann/lines-of-code
A PHP library for counting lines of code in source files, used to gather code...
sebastianbergmann/php-code-coverage
php-code-coverage is a specialized PHP library for collecting, processing, and...
sebastianbergmann/environment
This PHP library provides utilities for detecting and handling runtime-specific...
sebastianbergmann/comparator
This component provides functionality to compare PHP values for equality, with...
| Repository | Stars | Week Δ | Language | Score | Updated |
|---|---|---|---|---|---|
|
|
1.3k | — | PHP | 8/10 | 2d ago |
|
|
1.2k | — | PHP | 8/10 | 1d ago |
|
|
8.9k | — | PHP | 8/10 | 7h ago |
|
|
6.8k | — | PHP | 8/10 | 2d ago |
|
|
7.1k | — | PHP | 8/10 | 2w ago |
|
|
20k | — | PHP | 9/10 | 6h ago |
Broader static analysis tool including complexity metrics alongside other analyses; complexity appears as one metric among many. sebastian/complexity is narrower and likely used as a building block rather than end product.
Code style and quality checking tool; complexity checking is secondary feature. Different focus (lint/style vs. complexity metrics).
Type checking and static analysis frameworks; complexity analysis not primary concern. Operate at different abstraction level.
Parallel library from same author computing lines-of-code metrics. Serves adjacent code measurement concern with similar adoption pattern.
PHPUnit itself may offer basic complexity warnings; sebastian/complexity likely provides more granular, reusable metrics library.