PHP Graph is a VS Code extension that scans .php source files in your workspace and renders interactive, theme-aware UML class diagrams — with zero dependency on Composer or any framework runtime.
Features
Full PHP 8+ Type Support: Extracts class, interface, trait, and enum declarations, typed properties, enum cases, constructor property promotion, and method signatures.
Smart Relationship Detection: Resolves project-local extends, implements, use (traits), property association (including union A|B, intersection A&B, nullable ?A, and grouped use aliases), and optional constructor/method dependency (uses) edges.
Readable Dense Diagrams:
Edge Aggregation: Merges parallel associations between the same two types.
Namespace Clustering: Groups classes visually by namespace.
Interactive Filters: Toggle Methods, Associations, Dependencies, Hide isolated, Namespaces, or filter by a specific namespace.
Resizable Cards: Click ↔ on any card (or drag its right edge) to expand and inspect long method signatures.
Focus Mode & Search: Click any card to highlight it in orange and its connected relationships in blue, or use Find type... to jump directly to a type.
Source Navigation & Auto-Refresh: Double-click (or Ctrl/Cmd + click) a card to open its .php file at the declaration; diagrams refresh automatically on save.
Export: Copy as Mermaid (classDiagram) or save as standalone SVG.
Usage
File Diagram: Right-click a .php file in the editor or Explorer and select PHP Graph: Show File Diagram.
Folder Diagram: Right-click a folder in the Explorer and select PHP Graph: Show Project Diagram.
Workspace Diagram: Run PHP Graph: Show Project Diagram from the Command Palette.
Development
bun run compile — Type-check with TypeScript (tsc --noEmit)
bun test — Run unit tests
bun run build — Bundle the extension into dist/extension.js with esbuild