Graphify before you refactor: how I map a Laravel codebase in 10 minutes

Short answer: Before a multi-file Laravel refactor, I run Graphify (graphify update .) and read graphify-out/GRAPH_REPORT.md for god nodes and communities—then I know which controllers, writers, and tests must move together.

What is Graphify? explains the concept; this is my weekly habit on aviwebsquad.in.

When I run it

What I look for in GRAPH_REPORT.md

  1. God nodes — classes with fan-in/fan-out spikes (BlogPost, SeoSettings, route files)
  2. Communities — Filament vs HTTP vs MCP API clusters should stay separated
  3. Surprise edges — e.g., SEO logic leaking into models

If Graphify shows FaqJsonLdBuilder only connected to three controllers, I know exactly where to add tests when changing JSON-LD.

Pairing with automated refactors

Rector is fast and blind. Graphify is slow-ish and sees structure. Order:

graphify update .
rector process --dry-run
pest --filter=Seo

MCP agents read the same graph

Project rules tell agents to read Graphify output before architecture answers—reduces “edit the wrong file” failures when using secure MCP APIs.

FAQ

Cost?

AST-only Graphify updates are local—no API spend on this project.

Replace static analysis?

No—combine with Larastan. Graphify answers relationships, Larastan answers types.

Too small a repo?

Under ~20 PHP files, ripgrep is enough. Aviwebsquad crossed the threshold when Filament + MCP landed.

Example: refactoring SEO controllers

When I added crawlable HTML, Graphify showed BlogController, CategoryController, and FaqJsonLdBuilder in one community. I moved JSON-LD assembly into the builder only—grep would have missed HomeController’s partial duplicate.

CI hook (optional)

# .gitlab-ci.yml snippet
- ~/graphify-env/bin/graphify update . --fast || true

Non-blocking on PRs; fails deploy only if GRAPH_REPORT.md is stale and you enforce it (I do not—yet).

Limits

Graphify does not understand runtime routes or env flags. Pair with route:list and Wayfinder codegen.

FAQ (extended)

Monorepo?

Run per Laravel root; this site is single app.

Private packages?

Vendor is excluded by default—god nodes in vendor/ are noise anyway.