callgraph: a static call-graph / code-map CLI for PHP codebases (who calls this, what does this method call), free and MIT
Disclosure: I'm the author. Free, MIT-licensed, open source, no account.
callgraph is a command-line tool that parses PHP (and also TS/Vue, Rust, Swift, Python, Go) and prints a compact map of a file or directory instead of the file itself: classes, methods with line ranges, and the calls each method makes, grouped by kind (same-class helper, framework/facade use, external call, instantiation, ...).
What I use it for on legacy PHP:
"Who calls this method?" A name pattern finds every call site with its source line, and
--depth Nfollows callers of callers for impact analysis before a change.Type-aware where it can be:
Type::methodmatches calls resolved to that type, including calls that go through an interface, parent class or trait (shown asvia <Type>). Calls whose receiver type is unknown are kept out of the default answer, counted, and available with--guess, marked?.Framework views for Laravel and Yii-style code: routes, middleware, validation, jobs, events/listeners, service providers and container bindings, magic methods.
A public-API view with DocBlock param/return shapes, and a layered profile of the project (controllers, services, repositories, models, ...) inferred from folder and file names and checked against the call graph.
One static binary (written in Rust, tree-sitter / a PHP parser underneath). It runs locally and uploads nothing. It was built so AI coding agents (Claude Code, MCP clients) can navigate a repo without reading whole files, but it's a plain CLI and works fine without any AI.
Limits, honestly: it's static analysis. Anything decided at runtime ($this->$method(), $class::$m(), app($name), config-built bindings, magic __call) cannot be resolved. That is the main limitation, and I'm working on marking those spots explicitly so the output doesn't look cleaner than the code really is.
I'd like feedback from people maintaining large PHP codebases: where does a static call graph mislead you most, and which framework-specific views would you want next (Symfony? WordPress hooks?)