Visualize your Laravel request lifecycle as an interactive graph
Visualize your Laravel request lifecycle as an interactive graph
Visualize your Laravel application's full request lifecycle as an interactive graph.
Understand how routes, controllers, services, models, jobs, events, commands, and channels connect — in seconds.
LaraMint\LaravelBrain is a zero-config developer tool that analyzes your Laravel codebase and renders an interactive node graph of your application's architecture. It traces every route through its controller, services, repositories, models, jobs, events, Artisan commands, scheduled tasks, broadcast channels, and Filament panels — giving you a bird's-eye view of the entire application without reading a single line of code.
The scan writes JSON graph files to storage/app/laravel-brain/. The viewer is served at /_laravel-brain entirely through your existing Laravel routes — no separate server process needed.
EventServiceProvider::$listen/$subscribe, or #[AsEventListener] attributes, and links them to the events they handleroutes/console.php, and Kernel-registered commandscommand, job, call) with the time it runs, its timezone, and its overlap/one-server guardsroutes/channels.phpShouldBroadcast/broadcastOn() from each event and draws an edge to the channel(s) it broadcasts on, with the alias, queue, and payload shape in the event's detail panelfile_get_contents calls that leave the application, with host, method, timeout and retry — including requests built in one class and sent from anotherCache:: facade and cache() helper calls per method, split into read / write / invalidate / lock, with the key (literal or constructed — a computed one is labelled, never guessed), plus tags, store and TTL where declaredMacroable::macro()/::mixin() (Filament's own Macroable included) and draws them as their own node kind, so a call like $table->money() isn't a dead end when you go looking for where it came fromDB::transaction() closure (or a manual begin/commit range), with a rollback path in a catch block boundaried separatelyBus::chain()/Bus::batch()/withChain(), with arrows through a chain in its run orderhasMany, belongsTo, and other Eloquent relationsRelation::morphMap() gives each model — the value that actually lands in *_type columns — and flags a model an enforced map leaves out__invoke/handle/execute, filed under Actions/) as their own kind rather than as generic services, and surfaces the entry method they are invoked through#[ObservedBy], Model::observe(), or booted()) and links them to the models they observe#[UsePolicy] attribute, or naming convention) and links it in the graphprovides() key nothing backs, or the legacy $defer property the framework no longer reads@include, @extends, @component, @each, and `` components as view → view edges, so a shared partial shows every entry point it reachesUserResource::make()/::collection()/new and nested resource composition as edges, so a changed resource shows every controller and resource that uses itapp/ re-traces only the affected controllers and merges the result into the previous graph instead of rebuilding it from scratchlaramint/laravel-stress): configure request count, concurrency, headers, body, and timeout; see timing percentiles (min/avg/p50/p95/p99/max), throughput, and status distribution in the sidebar. While a run is active, the graph highlights the route and animates packets along the request pathlaravel/ai agents and the tools they expose to the model on the graph, with a standalone tab so an agent nothing else reaches is still visiblebrain:export-context Artisan command and GET /_laravel-brain/api/context API endpoint. Context includes call chain, complexity hotspots, DB operations, cache operations, source snippets, and all backend/frontend packages — always reproducible from the same scan databrain:generate-rules. Each file is populated with your project's real architecture, routes, packages, and code-health dataInstall as a dev dependency (it's a development tool, not needed in production):
composer require --dev laramint/laravel-brainLaravel will auto-discover the service provider. No manual registration needed.
php artisan brain:scanThis analyzes your entire codebase and writes the graph data to storage/app/laravel-brain/. When complete it prints the URL to open:
LaraMint\LaravelBrain — analyzing project...
Path: /your/project
Scanning routes, controllers, models and call chains...
Done! Open the viewer at: http://localhost:8000/_laravel-brainThe scanner defaults to 1024M. On larger codebases you can raise the limit with --memory-limit:
php artisan brain:scan --memory-limit=1G
php artisan brain:scan --memory-limit=2G
php artisan brain:scan --memory-limit=2048M
# Unlimited (use with caution)
php artisan brain:scan --memory-limit=-1Accepted formats: M (megabytes), G (gigabytes), or -1 (unlimited). The minimum allowed value is 1024M.
Click the **** button in the node sidebar to copy a structured Markdown context block to your clipboard, ready to paste into Claude, ChatGPT, or any LLM.
The context is deterministic: same scan + same node = identical output every time. It uses BFS up to depth 3 from the selected node and enforces a token budget (default 6 000 tokens), truncating only source snippets once structural metadata is fully included.
You can also run 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
# Target a specific node ID
php artisan brain:export-context --node="action::App\Http\Controllers\UserController::index"
# Write to a file instead of stdout
php artisan brain:export-context --route="GET /api/orders" --output=/tmp/context.md
# JSON format
php artisan brain:export-context --format=jsonOr via the API:
GET /_laravel-brain/api/context?nodeId=&budget=6000
GET /_laravel-brain/api/context?route=GET+/users&format=jsonThe exported Markdown contains:
Route → Controller → Service → Model (depth ≤ 3)composer.json dependencies with versions, dev flagpackage.json dependencies with versions, dev flagPopulate context files for your AI coding tools directly from the scan data.
From the UI: Toolbar → Export → Generate AI Rules → select targets → Generate.
From the terminal:
# GeNo open issues yet, or sync has not completed.