# patryyyck/phpflow architecture

> Architecture diagram of the GitHub repository patryyyck/phpflow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/patryyyck/phpflow
- Repository: https://github.com/patryyyck/phpflow

## Overview

PHPFlow is a static analyzer for Symfony/PHP projects. Its main workflow scans source files, analyzes PHP and supported framework configuration, builds a flow graph, then lets users inspect flows, query impacts, or export results. The graph preserves HTTP, Messenger, service/repository, database, external-HTTP, response, and exception concepts. The source excerpts show key orchestration and graph construction; some impact and export branches are included based on the README and SOURCE INDEX, so their internal details are not expanded.

Main entry points: [`src/Application/AnalyzeProject.php`](https://github.com/patryyyck/phpflow/blob/main/src/Application/AnalyzeProject.php) (Analysis orchestration), [`src/Domain/Graph/Graph.php`](https://github.com/patryyyck/phpflow/blob/main/src/Domain/Graph/Graph.php) (Flow graph), [`src/Application/ScanProject.php`](https://github.com/patryyyck/phpflow/blob/main/src/Application/ScanProject.php) (Scan orchestration), [`src/Console/Application.php`](https://github.com/patryyyck/phpflow/blob/main/src/Console/Application.php) (Command registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI"]
  node_console["Command registration<br/>[Application.php]"]
  node_scan_cmd["Scan command<br/>[ScanCommand.php]"]
end

subgraph group_analysis["Project analysis"]
  node_scanner["Project scanner"]
  node_scan["Scan orchestration<br/>[ScanProject.php]"]
  node_analyze["Analysis orchestration<br/>[AnalyzeProject.php]"]
  node_indexer["Symbol indexer<br/>[ProjectIndexer.php]"]
  node_ast["PHP AST analysis"]
  node_messenger_reader["Messenger config reader"]
  node_php_messenger["PHP routing parser"]
  node_alias_reader["Service alias reader"]
  node_project_analysis["Analysis results"]
end

subgraph group_flow["Flow modeling"]
  node_graph_builder["Flow graph builder<br/>[BuildFlowGraph.php]"]
  node_graph[("Flow graph<br/>[Graph.php]")]
  node_traversal["Graph traversal"]
  node_subgraph["Route subgraph"]
end

subgraph group_queries["Queries"]
  node_impact["Impact analysis"]
  node_inspect["Flow inspection<br/>[InspectCommand.php]"]
end

subgraph group_outputs["Exports"]
  node_export_html["Interactive HTML<br/>[HtmlExporter.php]"]
  node_export_json["Graph JSON<br/>[JsonExporter.php]"]
  node_export_mermaid["Mermaid output"]
  node_diff["Graph comparison"]
end

node_user(("CLI user"))
node_target["Target project"]

node_user -->|"runs commands"| node_console
node_console -->|"registers"| node_scan_cmd
node_scan_cmd -->|"scans project"| node_scan
node_target -->|"provides source"| node_scanner
node_scan -->|"delegates scan"| node_scanner
node_scan -->|"feeds project"| node_analyze
node_analyze -->|"builds index"| node_indexer
node_analyze -->|"analyzes PHP"| node_ast
node_analyze -->|"reads routing"| node_messenger_reader
node_messenger_reader -->|"parses PHP config"| node_php_messenger
node_analyze -->|"reads aliases"| node_alias_reader
node_analyze -->|"produces results"| node_project_analysis
node_analyze -->|"passes analysis"| node_graph_builder
node_graph_builder -->|"constructs graph"| node_graph
node_graph -.->|"traverses flows"| node_traversal
node_graph -.->|"extracts routes"| node_subgraph
node_graph -->|"queries impacts"| node_impact
node_user -->|"requests inspection"| node_inspect
node_inspect -.->|"explores graph"| node_traversal
node_graph -->|"renders viewer"| node_export_html
node_graph -->|"serializes graph"| node_export_json
node_graph -->|"renders diagram"| node_export_mermaid
node_user -->|"compares exports"| node_diff

click node_console "https://github.com/patryyyck/phpflow/blob/main/src/Console/Application.php"
click node_scan_cmd "https://github.com/patryyyck/phpflow/blob/main/src/Console/Command/ScanCommand.php"
click node_scanner "https://github.com/patryyyck/phpflow/blob/main/src/Infrastructure/Scanner/DirectoryScanner.php"
click node_scan "https://github.com/patryyyck/phpflow/blob/main/src/Application/ScanProject.php"
click node_analyze "https://github.com/patryyyck/phpflow/blob/main/src/Application/AnalyzeProject.php"
click node_indexer "https://github.com/patryyyck/phpflow/blob/main/src/Ast/ProjectIndexer.php"
click node_ast "https://github.com/patryyyck/phpflow/blob/main/src/Ast/ProjectAstAnalyzer.php"
click node_messenger_reader "https://github.com/patryyyck/phpflow/blob/main/src/Infrastructure/Messenger/MessengerRoutingReader.php"
click node_php_messenger "https://github.com/patryyyck/phpflow/blob/main/src/Infrastructure/Messenger/PhpMessengerRoutingReader.php"
click node_alias_reader "https://github.com/patryyyck/phpflow/blob/main/src/Infrastructure/Symfony/SymfonyServiceAliasReader.php"
click node_project_analysis "https://github.com/patryyyck/phpflow/blob/main/src/Domain/Analysis/ProjectAnalysis.php"
click node_graph_builder "https://github.com/patryyyck/phpflow/blob/main/src/Application/BuildFlowGraph.php"
click node_graph "https://github.com/patryyyck/phpflow/blob/main/src/Domain/Graph/Graph.php"
click node_traversal "https://github.com/patryyyck/phpflow/blob/main/src/Application/TraverseFlowGraph.php"
click node_subgraph "https://github.com/patryyyck/phpflow/blob/main/src/Application/ExtractSubgraph.php"
click node_impact "https://github.com/patryyyck/phpflow/tree/main/src/Application"
click node_inspect "https://github.com/patryyyck/phpflow/blob/main/src/Console/Command/InspectCommand.php"
click node_export_html "https://github.com/patryyyck/phpflow/blob/main/src/Exporter/HtmlExporter.php"
click node_export_json "https://github.com/patryyyck/phpflow/blob/main/src/Exporter/JsonExporter.php"
click node_export_mermaid "https://github.com/patryyyck/phpflow/blob/main/src/Exporter/MermaidExporter.php"
click node_diff "https://github.com/patryyyck/phpflow/blob/main/src/Application/CompareGraphExports.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_console,node_scan_cmd,node_user toneBlue
class node_scanner,node_scan,node_analyze,node_indexer,node_ast,node_messenger_reader,node_php_messenger,node_alias_reader,node_project_analysis toneAmber
class node_graph_builder,node_graph,node_traversal,node_subgraph toneMint
class node_impact,node_inspect toneRose
class node_export_html,node_export_json,node_export_mermaid,node_diff,node_target toneIndigo
```

## Components

### CLI

- [Command registration](https://github.com/patryyyck/phpflow/blob/main/src/Console/Application.php): `src/Console/Application.php`
- [Scan command](https://github.com/patryyyck/phpflow/blob/main/src/Console/Command/ScanCommand.php): `src/Console/Command/ScanCommand.php`

### Project analysis

- [Project scanner](https://github.com/patryyyck/phpflow/blob/main/src/Infrastructure/Scanner/DirectoryScanner.php): `src/Infrastructure/Scanner/DirectoryScanner.php`
- [Scan orchestration](https://github.com/patryyyck/phpflow/blob/main/src/Application/ScanProject.php): `src/Application/ScanProject.php`
- [Analysis orchestration](https://github.com/patryyyck/phpflow/blob/main/src/Application/AnalyzeProject.php): `src/Application/AnalyzeProject.php`
- [Symbol indexer](https://github.com/patryyyck/phpflow/blob/main/src/Ast/ProjectIndexer.php): `src/Ast/ProjectIndexer.php`
- [PHP AST analysis](https://github.com/patryyyck/phpflow/blob/main/src/Ast/ProjectAstAnalyzer.php): `src/Ast/ProjectAstAnalyzer.php`
- [Messenger config reader](https://github.com/patryyyck/phpflow/blob/main/src/Infrastructure/Messenger/MessengerRoutingReader.php): `src/Infrastructure/Messenger/MessengerRoutingReader.php`
- [PHP routing parser](https://github.com/patryyyck/phpflow/blob/main/src/Infrastructure/Messenger/PhpMessengerRoutingReader.php): `src/Infrastructure/Messenger/PhpMessengerRoutingReader.php`
- [Service alias reader](https://github.com/patryyyck/phpflow/blob/main/src/Infrastructure/Symfony/SymfonyServiceAliasReader.php): `src/Infrastructure/Symfony/SymfonyServiceAliasReader.php`
- [Analysis results](https://github.com/patryyyck/phpflow/blob/main/src/Domain/Analysis/ProjectAnalysis.php): `src/Domain/Analysis/ProjectAnalysis.php`

### Flow modeling

- [Flow graph builder](https://github.com/patryyyck/phpflow/blob/main/src/Application/BuildFlowGraph.php): `src/Application/BuildFlowGraph.php`
- [Flow graph](https://github.com/patryyyck/phpflow/blob/main/src/Domain/Graph/Graph.php): `src/Domain/Graph/Graph.php`
- [Graph traversal](https://github.com/patryyyck/phpflow/blob/main/src/Application/TraverseFlowGraph.php): `src/Application/TraverseFlowGraph.php`
- [Route subgraph](https://github.com/patryyyck/phpflow/blob/main/src/Application/ExtractSubgraph.php): `src/Application/ExtractSubgraph.php`

### Queries

- [Impact analysis](https://github.com/patryyyck/phpflow/tree/main/src/Application): `src/Application`
- [Flow inspection](https://github.com/patryyyck/phpflow/blob/main/src/Console/Command/InspectCommand.php): `src/Console/Command/InspectCommand.php`

### Exports

- [Interactive HTML](https://github.com/patryyyck/phpflow/blob/main/src/Exporter/HtmlExporter.php): `src/Exporter/HtmlExporter.php`
- [Graph JSON](https://github.com/patryyyck/phpflow/blob/main/src/Exporter/JsonExporter.php): `src/Exporter/JsonExporter.php`
- [Mermaid output](https://github.com/patryyyck/phpflow/blob/main/src/Exporter/MermaidExporter.php): `src/Exporter/MermaidExporter.php`
- [Graph comparison](https://github.com/patryyyck/phpflow/blob/main/src/Application/CompareGraphExports.php): `src/Application/CompareGraphExports.php`

### Other components

- **CLI user**
- **Target project**

## Connections

- CLI user → Command registration: runs commands (evidence: `README.md`)
- Command registration → Scan command: registers (evidence: `src/Console/Application.php`)
- Scan command → Scan orchestration: scans project (evidence: `src/Console/Command/ScanCommand.php`)
- Target project → Project scanner: provides source (evidence: `README.md`)
- Scan orchestration → Project scanner: delegates scan (evidence: `src/Application/ScanProject.php`)
- Scan orchestration → Analysis orchestration: feeds project (evidence: `src/Console/Command/ScanCommand.php`)
- Analysis orchestration → Symbol indexer: builds index (evidence: `src/Application/AnalyzeProject.php`)
- Analysis orchestration → PHP AST analysis: analyzes PHP (evidence: `src/Application/AnalyzeProject.php`)
- Analysis orchestration → Messenger config reader: reads routing (evidence: `src/Application/AnalyzeProject.php`)
- Messenger config reader → PHP routing parser: parses PHP config (evidence: `src/Infrastructure/Messenger/MessengerRoutingReader.php`)
- Analysis orchestration → Service alias reader: reads aliases (evidence: `src/Application/AnalyzeProject.php`)
- Analysis orchestration → Analysis results: produces results (evidence: `src/Application/AnalyzeProject.php`)
- Analysis orchestration → Flow graph builder: passes analysis (evidence: `src/Console/Command/ScanCommand.php`)
- Flow graph builder → Flow graph: constructs graph (evidence: `src/Application/BuildFlowGraph.php`)
- Flow graph → Graph traversal: traverses flows
- Flow graph → Route subgraph: extracts routes
- Flow graph → Impact analysis: queries impacts (evidence: `src/Application/FindServiceImpact.php`)
- CLI user → Flow inspection: requests inspection (evidence: `README.md`)
- Flow inspection → Graph traversal: explores graph
- Flow graph → Interactive HTML: renders viewer (evidence: `src/Exporter/HtmlExporter.php`)
- Flow graph → Graph JSON: serializes graph (evidence: `src/Exporter/JsonExporter.php`)
- Flow graph → Mermaid output: renders diagram (evidence: `src/Exporter/MermaidExporter.php`)
- CLI user → Graph comparison: compares exports (evidence: `README.md`)
