i582/phpstats
61.0
Adequate · 21 September 2026
7.9k
lines of production code
Go
primary language
4
measurements over time
What this system is
PhpStats is a Go-based static analysis tool that collects and calculates qualitative code metrics, such as cyclomatic complexity and dependency graphs, for PHP projects. It provides a CLI and server interface to inspect class, function, and namespace relationships, including reachability and inheritance structures. The system supports YAML configuration and generates structured data for visualization and further processing.
Features
Add class and namespace metric calculations
New metric calculation functions have been added to the stats package. For classes, the system now calculates afferent, efferent, and instability metrics, as well as Lack of Cohesion in Methods (Lcom and Lcom4). For namespaces, it calculates afferent, efferent, and instability metrics, along with abstractness. These changes introduce new internal logic for analyzing code structure and dependencies.
internal/stats/metrics · high confidence
Added function and method statistics for cyclomatic complexity and magic numbers
The stats package now includes detailed metrics for functions and methods, specifically calculating cyclomatic complexity and counting magic numbers. This provides users with deeper insights into code complexity and potential maintenance issues within the analyzed codebase.
github.com/i582/phpstats · high confidence
Initial release of PhpStats v1.0
PhpStats is now available as a Go-based tool for collecting code statistics, calculating qualitative metrics (such as cyclomatic complexity, LCOM4, and instability), building dependency graphs, and analyzing symbol relationships. The release includes a CLI interface, a YAML configuration file for project settings, and a Makefile for build and test automation.
(repo-wide) · high confidence
Introduce YAML-based configuration system with interactive setup wizard
Users can now configure the application via a new \internal/config\ package that reads settings from a \phpstats.yml\ file. The configuration supports project name, include/exclude paths, port, cache directory, and file extensions. An interactive wizard (\ConfigureConfig\) guides users through setting up this initial configuration file, prompting for the project name and source path. The system also supports package-based analysis via the \Packages\ struct, allowing users to define namespaces for specific packages.
internal/config · high confidence
Introduce internal graphing engine for dependency visualization
The internal/grapher package now includes a complete graphing engine that generates dependency graphs for classes, functions, files, and namespaces. This adds support for visualizing class inheritance and implementation relationships, function call dependencies, file inclusion chains, and namespace dependencies, with automatic color-coding and scaling based on connection density.
internal/grapher · high confidence
Introduce new interactive shell framework
The internal/shell package has been refactored to support a new interactive shell architecture. This introduces a Context struct for managing command arguments, flags, and execution state, alongside an Executor model that supports sub-commands, aliases, and help page generation. The Shell struct now manages a registry of executors and provides completion suggestions for the interactive prompt, enabling a more structured and extensible command-line interface.
internal/shell · high confidence
Introduce shell flag parsing with support for key-value pairs
Added a new internal/shell/flags package that provides a custom flag parsing mechanism. This allows the shell to process command-line arguments, including support for flags with values (e.g., --flag=value or --flag value) and distinguishing between flags and positional arguments. The implementation includes a Flag struct to define expected flags and a ParseFlags function to process the argument list, enabling more flexible command-line interface interactions.
internal/shell/flags · high confidence
New internal APIs for analyzing class, function, and reachability relationships
The internal/relations package now provides new types and functions to analyze relationships between classes, functions, and reachability paths. Specifically, it introduces Class2ClassRelation and Class2FuncRelation to track how classes and functions interact (e.g., which methods/fields/constants are used between them), and Func2FuncRelation to determine if one function is reachable from another, including the specific call paths. These changes enable the tool to report detailed dependency and reachability information for classes and functions.
internal/relations · high confidence
New shell commands for project analysis and dependency visualization
The CLI now includes several new commands to inspect and visualize project structure. The 'about' command displays utility information, while 'brief' provides a high-level statistical overview of the project. Users can now generate dependency graphs for files, classes, interfaces, and functions using the 'graph' command, which supports browser display and file output. Additionally, 'info' allows detailed inspection of specific classes, interfaces, traits, functions, files, and namespaces. The 'relation' command enables analysis of reachability between functions and relationships between classes and functions. Finally, 'metrics' provides documentation on the collected metrics, and 'list' allows browsing functions, methods, and files with sorting and JSON export options.
internal/shell/commands · high confidence
Architecture
Internal refactoring of the stats/symbols package
The internal stats/symbols package has been split into separate, dedicated files for each symbol type (classes, constants, fields, files, namespaces), each with its own struct and methods for counting, retrieving, and managing those symbols. This change improves code organization and maintainability by separating concerns within the statistics engine.
internal/stats/symbols · high confidence
Refactored internal stats collection into dedicated walker and indexer components
The internal stats package has been restructured to separate concerns between indexing and checking phases. A new \filemeta\ package now handles the serialization and deserialization of file-level metadata, while the \walkers\ package is split into \root\ and \block\ checkers and indexers. This refactoring improves the maintainability of the stats collection logic by clearly distinguishing between the initial indexing pass (which gathers raw data) and the subsequent analysis pass (which computes metrics like cyclomatic complexity and magic number counts).
internal/stats/walkers · high confidence
Behavioural changes
Added utility functions for path resolution, cache management, and system integration
A new internal utility package was introduced, providing helper functions for resolving PHP require paths, managing default cache and graph directories, and opening URLs across different operating systems. The package includes functions for generating indentation, checking file existence, calculating percentages, and normalizing string formats.
internal/utils · high confidence
CLI migrated to urfave/cli library
The command-line interface has been rewritten to use the urfave/cli library, replacing the previous implementation. This change introduces a new 'collect' command that accepts flags for port, cache directory, project path, and configuration path, and integrates with the internal shell and stats walkers to process PHP projects.
internal/cli · high confidence
Introduce structured data models and table representations for classes, files, functions, and namespaces
The internal/representator package now provides dedicated data structures (ClassData, FileData, FunctionData, NamespaceData) that map internal symbols to serializable formats. This enables consistent JSON output for the server and structured table views for the CLI. The changes add support for sorting and filtering by new metrics, including count of fully typed methods, abstractness, and cyclomatic complexity, while also introducing a 'found' flag in JSON responses to indicate whether a specific class, file, function, or namespace was located.
internal/representator · high confidence
Server endpoints return structured JSON responses
The server now returns JSON-formatted responses for class, function, and namespace information endpoints. Each response includes a 'data' field containing the specific information and a 'found' flag indicating whether the requested item was located. Additionally, the /analyzeStats endpoint provides a JSON object with 'state' and 'current' fields to report indexing or linting progress.
internal/server · medium confidence
Test coverage
Added test fixtures for class, method, namespace, and trait communication
Added new test fixtures in the tests directory to support analysis of code relationships. This includes a dummy Go test and multiple PHP test data files covering class communication (constants, fields, inheritance, methods), file dependencies, namespace interactions, trait usage, and class relations. These files provide sample code for testing the detection of dependencies and interactions between different code elements.
tests · high confidence
Dependencies
Initial Go module setup with 18 dependencies
The project initializes its Go module as github.com/i582/phpstats with Go 1.15, establishing the foundation for the application. This includes 18 dependencies such as urfave/cli for command-line handling, go-prompt and promptui for interactive shells, simpletable for output formatting, and gonum for statistical calculations.
(dependencies) · medium confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 61 → 61 (+0.3)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 85 → 89 (+3.5)
- Architecture 100 → 95 (-4.6)
- Maturity 48 → 47 (-0.6)
- Readiness 57 → 56 (-0.7)
- Security 87 → 93 (+5.7)
Resolved (32)
- Coverage not included — suite not readable by the collector
- Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
- Duplicated block (10 lines × 3) (internal/shell/shell.go)
- Duplicated block (12 lines × 2) (internal/shell/commands/list.go)
- Duplicated block (12 lines × 4) (internal/getter/classes.go)
- Duplicated block (12 lines × 6) (internal/shell/commands/list.go)
- Duplicated block (13 lines × 3) (internal/shell/commands/list.go)
- Duplicated block (14 lines × 2) (internal/shell/commands/graph.go)
- Duplicated block (15 lines × 3) (internal/grapher/namespaces.go)
- Duplicated block (15 lines × 4) (internal/shell/commands/graph.go)
- Duplicated block (15 lines × 8) (internal/shell/commands/list.go)
- Duplicated block (16 lines × 2) (internal/getter/files.go)
- Duplicated block (16 lines × 2) (internal/shell/commands/graph.go)
- Duplicated block (16 lines × 3) (internal/shell/commands/graph.go)
- Duplicated block (17 lines × 2) (internal/shell/commands/graph.go)
- Duplicated block (17 lines × 6) (internal/shell/commands/list.go)
- Duplicated block (22 lines × 3) (internal/grapher/class.go)
- Duplicated block (6 lines × 2) (internal/grapher/files.go)
- Duplicated block (8 lines × 2) (internal/grapher/class.go)
- Duplicated block (8 lines × 2) (internal/shell/executor.go)
- …and 12 more
New (74)
- Dependency pinned to a stale untagged commit: github.com/VKCOM/noverify
- Dependency pinned to a stale untagged commit: github.com/alexeyco/simpletable
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Duplicated block (10 lines × 2) (internal/grapher/class.go)
- Duplicated block (10 lines × 2) (internal/grapher/class.go)
- Duplicated block (10 lines × 3) (internal/grapher/class.go)
- Duplicated block (10 lines × 4) (internal/representator/class.go)
- Duplicated block (11 lines × 2) (internal/shell/commands/list.go)
- Duplicated block (12 lines × 3) (internal/shell/commands/graph.go)
- Duplicated block (12 lines × 6) (internal/shell/commands/list.go)
- Duplicated block (13 lines × 3) (internal/shell/commands/list.go)
- Duplicated block (13 lines × 4) (internal/getter/classes.go)
- Duplicated block (14 lines × 2) (internal/grapher/templates/constant.go)
- Duplicated block (14 lines × 3) (internal/shell/shell.go)
- Duplicated block (14 lines × 4) (internal/shell/commands/graph.go)
- Duplicated block (14 lines × 8) (internal/shell/commands/list.go)
- Duplicated block (15 lines × 2) (internal/shell/commands/graph.go)
- Duplicated block (15 lines × 6) (internal/shell/commands/list.go)
- Duplicated block (16 lines × 2) (internal/shell/commands/graph.go)
- …and 54 more
Architecture
- Unchanged — 0 containers · 1 contexts · 0 edges
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
i582/phpstats was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit acd0ee668319a27be675b7bb7c9813217e619a09 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-fa71c66cabd8.