Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Laravel Brain: Visualize Your Application's Request Lifecycle

Last updated 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
PhpStorm logo

PhpStorm

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

PhpStorm
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
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
Lucky Media logo

Lucky Media

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

Lucky Media
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
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
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
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
Shift logo

Shift

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

Shift

The latest

View all →
Laravel Shopper: A Headless E-Commerce Admin Panel for Laravel image

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

Read article
Chevere Workflow: A Declarative PHP Workflow Engine with Async Job Execution image

Chevere Workflow: A Declarative PHP Workflow Engine with Async Job Execution

Read article
Laravel Schema Sentinel: Detect and Fix Database Schema Drift image

Laravel Schema Sentinel: Detect and Fix Database Schema Drift

Read article
Laravel Web Push Notifications image

Laravel Web Push Notifications

Read article
RedBerry to Host Georgia's First Laravel Meetup in Tbilisi image

RedBerry to Host Georgia's First Laravel Meetup in Tbilisi

Read article
Interruptible Jobs in Laravel 13.7.0 image

Interruptible Jobs in Laravel 13.7.0

Read article