{"id":50848009,"url":"https://github.com/hightemp/php-call-graph-viz","last_synced_at":"2026-06-14T11:04:41.707Z","repository":{"id":338047143,"uuid":"1156350537","full_name":"hightemp/php-call-graph-viz","owner":"hightemp","description":"A static analysis tool that parses PHP(7.4-8.2) source code and generates visual call graphs using Graphviz. Written in Go.","archived":false,"fork":false,"pushed_at":"2026-02-12T15:02:18.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-12T23:40:29.748Z","etag":null,"topics":["ast","call-graph","golang","php"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hightemp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-12T14:52:57.000Z","updated_at":"2026-02-12T15:07:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/hightemp/php-call-graph-viz","commit_stats":null,"previous_names":["hightemp/php-call-graph-viz"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/hightemp/php-call-graph-viz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hightemp%2Fphp-call-graph-viz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hightemp%2Fphp-call-graph-viz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hightemp%2Fphp-call-graph-viz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hightemp%2Fphp-call-graph-viz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hightemp","download_url":"https://codeload.github.com/hightemp/php-call-graph-viz/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hightemp%2Fphp-call-graph-viz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34318546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","call-graph","golang","php"],"created_at":"2026-06-14T11:04:41.011Z","updated_at":"2026-06-14T11:04:41.698Z","avatar_url":"https://github.com/hightemp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Call Graph Visualizer\n\n![Experimental](https://img.shields.io/badge/status-experimental-orange)\n![Vibe Coded](https://img.shields.io/badge/vibe-coded-blueviolet)\n![](https://goreportcard.com/badge/github.com/hightemp/php-call-graph-viz)\n\nA static analysis tool that parses PHP source code and generates visual call graphs using Graphviz. Written in Go.\n\n![](./screenshots/2026-02-12_17-59.png)\n\n## Features\n\n- **Static PHP parsing** — uses [VKCOM/php-parser](https://github.com/VKCOM/php-parser) to build a full AST (PHP 5.x–8.1)\n- **Heuristic type resolution** — tracks `new`, parameter type hints, property types, and `$this` to resolve `$var-\u003emethod()` calls\n- **Multiple output formats** — SVG, PNG, JPG, DOT\n- **Flexible grouping** — cluster nodes by class, by namespace, or render a flat graph\n- **Granularity control** — method-level or class-level (collapsed) call graphs\n- **Rich filtering** — include/exclude by namespace, class, or method name; entry-point + depth limiting\n- **Manual type mappings** — override unresolvable types via `config.yaml`\n- **Parallel parsing** — configurable worker pool for large codebases\n- **Color-coded nodes \u0026 edges** — classes, interfaces, traits, enums, functions, static/instance/nullsafe calls are visually distinct\n\n## Installation\n\n### Quick Install (Recommended)\n\n**Linux / macOS:**\n```bash\ncurl -sSL https://raw.githubusercontent.com/hightemp/php-call-graph-viz/main/install.sh | bash\n```\n\n**Windows (PowerShell):**\n```powershell\nirm https://raw.githubusercontent.com/hightemp/php-call-graph-viz/main/install.ps1 | iex\n```\n\n### Alternative Methods\n\n**Using Go:**\n```bash\ngo install github.com/hightemp/php-call-graph-viz/cmd@latest\n```\n\n**Download pre-built binaries:**\n\nVisit the [releases page](https://github.com/hightemp/php-call-graph-viz/releases/latest) to download binaries for:\n- Linux (x86_64, arm64)\n- macOS (x86_64, arm64)\n- Windows (x86_64)\n\n**Build from source:**\n```bash\ngit clone https://github.com/hightemp/php-call-graph-viz.git\ncd php-call-graph-viz\nmake build\n```\n\n## Makefile Commands\n\nThe project includes a Makefile for common tasks:\n\n```bash\nmake build        # Build the binary\nmake install      # Install to $GOPATH/bin\nmake clean        # Remove binary and clean cache\nmake test         # Run tests\nmake run          # Build and run with config.yaml\nmake run-test     # Build and run with test/config.yaml\nmake fmt          # Format code\nmake vet          # Run go vet\nmake lint         # Run golangci-lint\nmake deps         # Download dependencies\nmake deps-update  # Update dependencies\nmake help         # Show all available targets\n```\n\n## Quick Start\n\n1. Build the project:\n\n```bash\nmake build\n```\n\n2. Copy the sample configuration and adjust it for your project:\n\n```bash\ncp config.yaml my-config.yaml\n```\n\n3. Edit `source_dirs` in `my-config.yaml` to point to your PHP source directories.\n\n4. Run the tool:\n\n```bash\n./php-call-graph-viz -config my-config.yaml\n```\n\nOr use the Makefile:\n\n```bash\nmake run          # Uses config.yaml\nmake run-test     # Uses test/config.yaml\n```\n\nThe output file (default: `callgraph.svg`) will be generated in the current directory.\n\n## Configuration\n\nAll options are set via a YAML file (default: `config.yaml`).\n\n| Option | Type | Default | Description |\n|---|---|---|---|\n| `source_dirs` | `[]string` | — | Directories to scan for `.php` files |\n| `php_version` | `string` | `\"8.1\"` | PHP version for the parser |\n| `output_format` | `string` | `\"svg\"` | Output format: `svg`, `png`, `jpg`, `dot` |\n| `output_file` | `string` | `\"callgraph.svg\"` | Output file path |\n| `group_by` | `string` | `\"class\"` | Grouping: `class`, `namespace`, `none` |\n| `granularity` | `string` | `\"method\"` | Detail level: `method` or `class` |\n| `layout` | `string` | `\"dot\"` | Graphviz layout engine: `dot`, `circo`, `fdp`, `neato`, `sfdp`, `twopi` |\n| `rank_dir` | `string` | `\"TB\"` | Graph direction: `TB`, `LR`, `BT`, `RL` |\n| `max_depth` | `int` | `0` | Max call chain depth from entry points (0 = unlimited) |\n| `entry_points` | `[]string` | `[]` | Restrict graph to calls reachable from these FQN methods |\n| `workers` | `int` | `4` | Number of parallel parsing goroutines |\n| `resolve_types` | `bool` | `false` | Enable heuristic type resolution |\n| `show_unresolved` | `bool` | `false` | Show unresolved calls as dashed edges |\n| `show_functions` | `bool` | `false` | Include standalone function calls |\n| `type_mappings` | `map` | `{}` | Manual `$var` → FQN type overrides |\n\n### Filters\n\n```yaml\nfilters:\n  include_namespaces:\n    - \"App\\\\Services\"\n    - \"App\\\\Repositories\"\n  exclude_namespaces:\n    - \"App\\\\Tests\"\n  include_classes: []\n  exclude_classes:\n    - \"App\\\\Services\\\\LogService\"\n  exclude_methods:\n    - __construct\n    - __destruct\n```\n\n### Entry Points\n\nRestrict the graph to calls reachable from specific methods:\n\n```yaml\nentry_points:\n  - \"App\\\\Controllers\\\\UserController::index\"\nmax_depth: 3\n```\n\n### Type Mappings\n\nManually specify types when automatic resolution fails:\n\n```yaml\ntype_mappings:\n  \"$container\": \"App\\\\Container\\\\AppContainer\"\n  \"App\\\\Services\\\\BaseService::$em\": \"Doctrine\\\\ORM\\\\EntityManager\"\n```\n\n## Example Configuration\n\n```yaml\nsource_dirs:\n  - ./src\n\nphp_version: \"8.1\"\noutput_format: svg\noutput_file: callgraph.svg\ngroup_by: class\ngranularity: method\nlayout: dot\nrank_dir: LR\nworkers: 8\nresolve_types: true\nshow_unresolved: false\nshow_functions: false\n\nfilters:\n  include_namespaces: []\n  exclude_namespaces: []\n  include_classes: []\n  exclude_classes: []\n  exclude_methods:\n    - __construct\n    - __destruct\n\ntype_mappings: {}\n```\n\n## Visual Legend\n\n| Element | Appearance |\n|---|---|\n| Class method | Blue box |\n| Interface method | Green box |\n| Trait method | Orange box |\n| Enum method | Purple box |\n| Standalone function | Pink ellipse |\n| Unresolved call | Gray dotted ellipse |\n| Instance call (`-\u003e`) | Blue solid arrow |\n| Nullsafe call (`?-\u003e`) | Blue dashed arrow |\n| Static call (`::`) | Red solid arrow (thicker) |\n| `new` expression | Green dotted arrow (diamond head) |\n| Function call | Purple solid arrow |\n| Dynamic call (`$obj-\u003e$method`) | Orange dotted arrow |\n\n## Project Structure\n\n```\ncmd/\n  main.go              # CLI entry point\ninternal/\n  config/\n    config.go          # YAML config loading \u0026 defaults\n  phpparse/\n    parser.go          # Parallel PHP file discovery \u0026 parsing\n    symbols.go         # Symbol table: classes, methods, properties, traits\n  callgraph/\n    graph.go           # Call graph data structure \u0026 filtering\n    visitor.go         # AST visitor that extracts call edges\n    resolver.go        # Heuristic type resolver\n  render/\n    graphviz.go        # Graphviz rendering with grouping \u0026 styling\n```\n\n## Requirements\n\n- Go 1.21+\n\n## License\n\nMIT\n\n![](https://asdertasd.site/counter/php-call-graph-viz)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhightemp%2Fphp-call-graph-viz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhightemp%2Fphp-call-graph-viz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhightemp%2Fphp-call-graph-viz/lists"}