The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

Laravel Brain: Visualize Your Application's Request Lifecycle

Published on by

Laravel Brain is a package that scans your Laravel application and renders an interactive graph of how requests flow through it. Install it, run the scan, and you'll get a visual map of your routes, controllers, services, repositories, models, jobs, events, Artisan commands, scheduled tasks, and broadcast channels—all in one place.

Main features:

  • Interactive lifecycle graph — Visualizes every route through controllers, services, models, jobs, and events as an interactive node graph with multiple layouts and dark/light themes.
  • AI context export — One-click (or brain:export-context) copies a structured Markdown snapshot of any node's call chain, DB ops, and source snippets for pasting into any LLM.
  • AI rules file generation — Generates context/rules files for seven AI coding assistants (Claude Code, Cursor, Windsurf, Copilot, Junie, Aider, AGENTS.md) from your real architecture data.
  • Route stress testing — Run concurrent HTTP load tests against any route node with configurable concurrency, headers, and body; see timing percentiles while the graph animates live.
  • Watch mode + fat-class detection — Auto-rescans on PHP file changes and flags controllers or services exceeding 300 lines or 10 methods as complexity hotspots.

The graph is served directly through your Laravel app at /_laravel-brain, so there's nothing extra to set up or deploy separately.

Interactive Graph

Each route, controller action, service, model, job, and event appears as a colored node with arrows showing how data moves between them. You can click any node to inspect its details, view the source code inline, or pull up a flowchart of the method's internal logic.

Routes are organized into their own tabs so you can focus on a single endpoint without wading through the whole application at once. You can export graphs as PNG or Mermaid diagrams and choose from several layouts—hierarchical dagre, force-directed, breadth-first, circle, or grid. Dark and light themes are included, and the viewer will flag "fat classes" (controllers or services with more than 300 lines or 10 methods) as a quick sanity check on code health.

AI Context Export

One handy feature is the ability to copy a context snapshot for any node directly to your clipboard. The exported Markdown includes the route, call chain up to three levels deep, complexity hotspots, database operations per node, source snippets, and your full composer.json and package.json dependency lists—formatted to paste straight into an AI coding tool.

You can also generate it from the terminal:

# Full project summary
php artisan brain:export-context
 
# Focused on a specific route
php artisan brain:export-context --route="GET /users" --budget=4000

The same data is available via the API at GET /_laravel-brain/api/context.

AI Rules Generation

The package can also generate context files for seven AI coding assistants from your scan data:

php artisan brain:generate-rules --target=claude --target=cursor

Each supported tool gets its own rules file, populated with your project's actual architecture, routes, packages, and code health data rather than generic boilerplate.

You can find full installation instructions and the source code on GitHub.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Tinkerwell

Enjoy coding and debugging in an editor designed for fast feedback and quick iterations. It's like a shell for your application – but with multi-line editing, code completion, and more.

Visit Tinkerwell
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
SerpApi logo

SerpApi

Access real-time search engine results through a simple API—no more scraping headaches! Use it for AI applications, SEO tools, product research, travel information, and more

SerpApi
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media

The latest

View all →
Laravel Installer Now Returns JSON When Running Inside an AI Agent image

Laravel Installer Now Returns JSON When Running Inside an AI Agent

Read article
Queue-Wide Inspection Methods in Laravel 13.8.0 image

Queue-Wide Inspection Methods in Laravel 13.8.0

Read article
Verifiable Audit Logging with Laravel Chronicle image

Verifiable Audit Logging with Laravel Chronicle

Read article
Ship AI with Laravel: Search Entire PDFs with Zero Search Logic image

Ship AI with Laravel: Search Entire PDFs with Zero Search Logic

Read article
Personalized Content Delivery System: Building an AI-powered recommendation engine with Laravel and MongoDB image

Personalized Content Delivery System: Building an AI-powered recommendation engine with Laravel and MongoDB

Read article
Laravel Shopper: A Headless E-Commerce Admin Panel for Laravel image

Laravel Shopper: A Headless E-Commerce Admin Panel for Laravel

Read article