phpgraph
Query a PHP code graph to inspect symbols, trace dependencies, assess change impact, and outline features before reading code.
Look up a class, interface, trait, enum, method, function, route, channel, or API operation and see its kind, file, line, and all incoming/outgoing relations with confidence.
Get what uses a node (callers, implementations, subclasses, instantiations) or what it depends on, in either direction.
Assess what may break when changing a class or method: direct and indirect dependents nearest-first, relation paths, weakest confidence, affected routes, tests to run, state-dependent code, and helpers.
Drill into one impact section uncut (
direct,routes,operations,state,tests,state-tests,helpers) or request compact, full, or JSON output.Outline a feature or method: class cluster, surrounding interfaces/base classes, route flow, behavior read from bodies, container wiring, users, and untested classes.
Resolves call-graph type inference through Doctrine APIs, allowing method chains involving Doctrine to be traced.
Analyzes Laravel projects, linking Laravel route files to controllers, recognizing Laravel jobs and events with their handlers, and resolving call chains through Laravel APIs.
Analyzes PrestaShop codebases, including PrestaShop CQRS message flows from sender to handler.
Links OpenAPI/Swagger operations to the routes that implement them, and reports documented operations without implementations or routes not described by a document.
Analyzes Symfony projects, including routes from Symfony attributes and YAML/PHP routing, Symfony Messenger sender-to-message-to-handler flows, and Symfony dependency injection configuration with tagged services and autowired iterators.
Analyzes WordPress codebases, including WordPress hooks and their registered handlers.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@phpgraph who calls OrderService::cancel and what breaks if I change it?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
In PHP, a caller rarely names the class it ends up running. It holds an interface and the container decides which class it gets; a bus carries a message to its handler; a route string reaches a controller. A coding agent searching names with grep has to rebuild that chain file by file, and sometimes guesses. phpgraph parses the project once and answers from a graph, over MCP, in one call.
Example: Sylius, OrderPromotionProcessor::process(). Searching for the class name finds two files: the class
and its service definition. No caller names it: they all hold OrderProcessorInterface, and the container gives
them a composite that runs the promotion processor among others. One impact_of call (phpgraph impact prints the same):
21 classes up to 3 relations away, 0 routes, 0 more through the state; 43 tests, 0 through the state; 1 helpers.
Direct dependents:
OrderPromotionCodeAssigner (Sylius\Bundle\ApiBundle\Assigner) [through OrderProcessorInterface::process()]: assign L41
BlameCartHandler (Sylius\Bundle\ApiBundle\CommandHandler\Cart) [through OrderProcessorInterface::process()]: __invoke L63
OrderModifier (Sylius\Component\Order\Modifier) [through OrderProcessorInterface::process()]: addToOrder L32; removeFromOrder L39
… 5 more, then 13 classes 2 or 3 relations away and the tests to runProcessOrderListener holds the same interface but is not listed: the configuration gives it the payment processor.
Demo

A 68-second video, the same question to Claude Code with and without phpgraph, one real run each: youtu.be/Cv4ULkN3FF0.
No LLM, no network, no embeddings: your code never leaves your machine, and phpgraph parses it without running it.
Every fact says how sure it is (EXTRACTED, INFERRED or AMBIGUOUS), and what phpgraph could not link is reported.
Related MCP server: LiLBrain
Where it helps and where it doesn't
Akeneo PIM (8,416 PHP files), task: list every class that must change when
GetCategoryInterface::byCode() takes a second parameter. Claude Code 2.1.325 with Sonnet, 15 November 2026:
phpgraph 2.3.0, 6 runs; without phpgraph, 3 runs:
With phpgraph | Without | |
Correct answers | 6/6 | 3/3 |
Tokens per run, median | 110,254 | 170,660 |
Tokens per run, range | 87,643 to 181,273 | 127,193 to 176,783 |
Time per run | 15.9 to 27.9 s | 15.9 to 26.8 s |
Where it helps: the same answer for 35 % fewer tokens (median) on the largest project; 3 runs out of 6 answered from
impact_of alone, the others checked it with one to three searches. Where it doesn't: on the 6 impact tasks of the benchmark,
with 2.2.0, phpgraph gave more right answers (17/18 against 15/18) but used 9.8 % more tokens in total, from −30 % to
+36 % per task, and time was not better. Results vary from run to run: with 2.2.0 the same Akeneo task took 87,000 to
222,000 tokens.
Every result, grouped by version, with the method: docs/BENCHMARKS.md.
Quick start
1. Install the executable (Linux, macOS; it carries its own PHP, none needed):
curl -fsSL https://raw.githubusercontent.com/alpine-ronin/phpgraph/main/install.sh | shIt checks the SHA-256 and installs to ~/.local/bin. Windows, Composer, PHAR and Docker:
docs/INSTALL.md.
2. Connect Claude Code. From your project directory:
phpgraph mcp-config claudeIt prints a claude mcp add phpgraph -- ... command with the paths filled in (run it), an .mcp.json to share
with the team instead, and a line for CLAUDE.md telling the agent to call phpgraph before grep. Codex, Cursor,
Sherpa and other MCP clients: phpgraph mcp-config codex|cursor|sherpa|json.
3. Ask. The graph is built on the first call, then kept up to date as you edit.
What you can ask
What breaks if I change this method?
impact_oflists every dependent, nearest first, callers through the interface it implements included, the routes reaching it and the tests to run.How does this feature work?
outlinegives the classes, the routes running into them, the behaviour read in their bodies, the wiring and the tests in one answer, so the agent reads only the files with non-obvious logic.Which handler receives this message, which controller serves this route? Senders, messages and handlers are linked for Symfony Messenger, Laravel, Ecotone, PrestaShop, WordPress hooks and your own buses; routes to their controllers, HTTP calls to the routes they reach.
Who calls this, in a large or old codebase? Receivers are typed from return types, docblocks, generics, branches and the signatures of
vendor/, and PHP 4 and 5 syntax is parsed.
What it is not
Not a runtime tool. It reads code and configuration, never runs them: services built at runtime (compiler passes, ids computed at runtime) and dynamic calls (
$this->$name(),__callwithout@method) stay unresolved.Not every framework. Symfony, Laravel, Ecotone, PrestaShop and WordPress conventions are recognised, plus generic ones (handler attributes,
*Handler,*Bus); others get the call graph only. Only PHP files are read.Better with
vendor/. Without installed dependencies, call chains stop at the first one.PHP versions. The project you analyse can be any PHP version, PHP 4 syntax included, and its PHP does not need to be installed. phpgraph itself needs no PHP as an executable or in Docker, and PHP 8.5 or newer with Composer or the PHAR.
The full list: docs/LIMITATIONS.md.
Documentation
Install: every method, every agent
MCP tools: the 8 tools, 4 listed by default
Command line:
build,impact,outline,check,serveand their optionsGraph schema and confidence levels: relations,
EXTRACTED/INFERRED/AMBIGUOUS, how it worksArchitecture rules: layers,
phpgraph checkin CI,phpgraph.yamlFrameworks: what is recognised, microservices, XML action routing
Benchmarks: agents with and without phpgraph, other code graphs, the measurement corpus
Limitations and FAQ
Contributing, code architecture, library providers, stability, changelog
The previous README, kept unchanged
License
MIT.
Available Tools
4 toolsget_neighborsA
Like get_node in one direction: "in" what uses it (callers, implementations, subclasses, instantiations), "out" what it depends on.
Inputs: name (required), direction.
get_nodeA
One class, interface, trait, enum, method or function: kind, file, line and every relation in and out, with its confidence. Lists the other nodes matching the name.
Inputs: name (required).
impact_ofA
Call this before changing a class or a method, instead of searching for its usages with grep. What may break when it changes: every class that depends on it, directly or through others (callers, subclasses, implementations, code that instantiates or references it, senders and handlers of a message), nearest first, each with the relation that reaches it and the weakest confidence on the way, then its methods reaching the change with the source lines of their calls. Follows methods, not whole classes: a class is reached only through the methods that use the change. Also reaches the callers of the interface or parent method a method implements (INFERRED), and, in a separate list, the code possibly affected through the state the method writes. Lists the tests to run apart, found through test helpers (fakers). Stops at a service receiving the change among others (a tagged collection) and at inherited code shared with other subclasses, which are listed but not followed. Lists the routes reaching the change, each with its chain down to the change. A large impact comes compact (routes cut, farther classes by name, indirect tests counted) and still names every direct dependent: the default answer is the one to use, other options are several times larger.
Inputs: name (required), depth, limit, format, +1 more.
outlineA
Call this first, before grep or reading files, to explain or document a feature or how something works ("how does stock reservation work"). From the classes the topic names: the cluster by namespace and layer (kind, docblock summary, public signatures, constants), the interfaces and base classes around it, the flow from the routes, behaviour read in the bodies (guarded throws, branches), container wiring, users and untested classes. A topic naming a method (OrderService::place) outlines what it runs, 3 calls deep.
Inputs: topic (required), format, section.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
get_node and get_neighbors overlap in purpose (full node vs. one-directional relations), but the descriptions clearly delimit them: get_node is bidirectional and includes node identity, while get_neighbors is explicitly one direction. impact_of and outline are clearly distinct higher-level analyses (change risk vs. topic explanation).
get_node and get_neighbors follow a clean verb_noun snake_case pattern, but impact_of is a noun/prepositional phrase and outline is a bare verb with no object. The conventions are mixed though still readable and unlikely to be misread.
Four tools is a tight, purposeful set for a PHP code-graph server: two low-level graph queries plus two high-level analyses. It is slightly thin (no discovery/search tool), but each tool clearly earns its place.
The surface covers node inspection, directional traversal, impact analysis, and topic outlining, which handles the core workflows of a code graph. A gap remains around discovery: there is no way to list or search nodes by pattern beyond name matching inside get_node, which could force agents to guess names.
Maintenance
Related MCP Connectors
Repository knowledge graph MCP server for codebase understanding and debugging.
Shared context for your codebase: a hosted code knowledge graph over MCP. Free plan, OAuth sign-up.
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
Ask who calls a route, what a change breaks or who reads a field, across a system's repos.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server that exposes Python function- and module-level call graphs for agentic coding clients, enabling tools like callers_of, callees_of, and neighborhood queries.MIT
- AlicenseBqualityDmaintenanceInstant codebase knowledge graph MCP server. It auto-detects languages, indexes functions, classes, and call chains, enabling LLMs to navigate code in milliseconds.24MIT
- AlicenseNot gradedqualityAmaintenanceThis MCP server exposes a local structural code graph and project memory so AI coding agents can retrieve focused code entities, relationships, and prior mistakes before reading full files. It enables bounded context queries, caller/callee and impact analysis, and carryover of recorded session information through a CLI, hooks, and an authenticated local dashboard.24 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding agents to retrieve focused structural context from a local code graph, inspect relationships, and carry project memory across sessions. It serves this context via MCP to reduce token usage while investigating code before making behavioral claims.24 npmMIT