[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1213":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":35,"lastSyncTime":36,"discoverSource":37},1213,"laravel-brain","laramint\u002Flaravel-brain","laramint","Visualize your Laravel request lifecycle as an interactive graph","https:\u002F\u002Flaramint.dev\u002F",null,"PHP",786,41,11,4,0,12,21,173,36,8.87,false,"main",true,[26,7,27,28,5,29,30,31],"brain","laravel","laravel-auto-crud","laravel-packages","packages","php","2026-06-12 02:00:24","\u003Cp align=\"center\">\n  \u003Cimg src=\"art\u002Fbanner.png\" alt=\"Laravel Brain\" width=\"300px\"\u002F>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>Visualize your Laravel application's full request lifecycle as an interactive graph.\u003C\u002Fstrong>\u003Cbr\u002F>\n  Understand how routes, controllers, services, models, jobs, events, commands, and channels connect — in seconds.\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLaravel-9%20%7C%2010%20%7C%2011%20%7C%2012%20%7C%2013-red?style=flat-square&logo=laravel\" alt=\"Laravel\"\u002F>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPHP-8.0%2B-777BB4?style=flat-square&logo=php\" alt=\"PHP\"\u002F>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-green?style=flat-square\" alt=\"License\"\u002F>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSponsor-GitHub-EA4AAA?style=flat-square&logo=github-sponsors\" alt=\"Sponsor\"\u002F>\n\u003C\u002Fp>\n\n---\n\n## What is LaraMint\\LaravelBrain?\n\nLaraMint\\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.\n\nThe scan writes JSON graph files to `storage\u002Fapp\u002Flaravel-brain\u002F`. The viewer is served at `\u002F_laravel-brain` entirely through your existing Laravel routes — no separate server process needed.\n\n## Features\n\n- **Full lifecycle tracing** — Follows every route from HTTP verb → controller → service → repository → model → events\u002Fjobs\n- **Filament PHP support** — Discovers panels, resources, pages, widgets, and relation managers; traces call chains from Filament page methods the same way controller actions are traced\n- **Artisan command discovery** — Maps class-based commands, closure commands from `routes\u002Fconsole.php`, and Kernel-registered commands\n- **Scheduler tracing** — Visualizes scheduled tasks (`command`, `job`, `call`) with their frequency\n- **Broadcast channel mapping** — Discovers class-based and closure channels from `routes\u002Fchannels.php`\n- **DB query tracing** — Surfaces Eloquent and raw queries per method\n- **Fat-class detection** — Flags controllers and services with more than 300 lines or 10 methods\n- **Cyclomatic complexity** — Highlights hotspots by complexity tier (Low \u002F Moderate \u002F High \u002F Critical)\n- **Interactive graph** — Dark\u002Flight theme, accent-colored nodes, and interactive edges\n- **Per-route tabs** — Each route gets its own isolated subgraph tab\n- **Middleware mapping** — Shows which middleware guards each route\n- **Model relationships** — Displays `hasMany`, `belongsTo`, and other Eloquent relations\n- **Method flowcharts** — See internal flow as a step-by-step diagram with a large modal popup view\n- **Sequence diagrams** — Route nodes render an SVG sequence diagram (exportable as PNG or Mermaid) showing the full actor chain\n- **Source viewer** — Read the actual source file inline or in a focused popup\n- **Export** — Export any graph as PNG or Mermaid diagram\n- **Multiple layouts** — Hierarchical (dagre), force-directed (cose-bilkent), breadth-first, circle, grid\n- **Watch mode** — Auto-rescans on PHP file changes\n- **Route stress test** — From a selected **route** node, run concurrent HTTP load against that endpoint (via [`laramint\u002Flaravel-stress`](https:\u002F\u002Fgithub.com\u002FLaraMint\u002Flaravel-stress)): configure request count, concurrency, headers, body, and timeout; see timing percentiles (min\u002Favg\u002Fp50\u002Fp95\u002Fp99\u002Fmax), throughput, and status distribution in the sidebar. While a run is active, the graph highlights the route and animates packets along the request path\n- **AI context export** — Copy a deterministic, token-optimized context snapshot for any node to your clipboard with one click (🤖 button in the sidebar). Also available as `brain:export-context` Artisan command and `GET \u002F_laravel-brain\u002Fapi\u002Fcontext` API endpoint. Context includes call chain, complexity hotspots, DB operations, source snippets, and all backend\u002Ffrontend packages — always reproducible from the same scan data\n- **AI rules generation** — Generate ready-to-use context files for seven AI coding assistants (Claude Code, Cursor, Windsurf, GitHub Copilot, JetBrains Junie, Aider, AGENTS.md) directly from the UI (**Export → Generate AI Rules**) or via `brain:generate-rules`. Each file is populated with your project's real architecture, routes, packages, and code-health data\n\n## Requirements\n\n- PHP 8.0+\n- Laravel 9, 10, 11, 12, or 13\n- Composer\n\n## Installation\n\nInstall as a dev dependency (it's a development tool, not needed in production):\n\n```bash\ncomposer require --dev laramint\u002Flaravel-brain\n```\n\nLaravel will auto-discover the service provider. No manual registration needed.\n\n## Usage\n\n### Scan your project\n\n```bash\nphp artisan brain:scan\n```\n\nThis analyzes your entire codebase and writes the graph data to `storage\u002Fapp\u002Flaravel-brain\u002F`. When complete it prints the URL to open:\n\n```\n  LaraMint\\LaravelBrain — analyzing project...\n  Path: \u002Fyour\u002Fproject\n\n  Scanning routes, controllers, models and call chains...\n\n  Done! Open the viewer at: http:\u002F\u002Flocalhost:8000\u002F_laravel-brain\n```\n\n### Export AI context for a node\n\nClick 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.\n\nThe 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.\n\nYou can also run it from the terminal:\n\n```bash\n# Full project summary\nphp artisan brain:export-context\n\n# Focused on a specific route\nphp artisan brain:export-context --route=\"GET \u002Fusers\" --budget=4000\n\n# Target a specific node ID\nphp artisan brain:export-context --node=\"action::App\\Http\\Controllers\\UserController::index\"\n\n# Write to a file instead of stdout\nphp artisan brain:export-context --route=\"GET \u002Fapi\u002Forders\" --output=\u002Ftmp\u002Fcontext.md\n\n# JSON format\nphp artisan brain:export-context --format=json\n```\n\nOr via the API:\n\n```\nGET \u002F_laravel-brain\u002Fapi\u002Fcontext?nodeId=\u003Cid>&budget=6000\nGET \u002F_laravel-brain\u002Fapi\u002Fcontext?route=GET+\u002Fusers&format=json\n```\n\nThe exported Markdown contains:\n\n- **Route** — method, URI, middleware\n- **Call chain** — `Route → Controller → Service → Model` (depth ≤ 3)\n- **Complexity hotspots** — cyclomatic complexity + line count table\n- **Database operations** — Eloquent and raw queries per node\n- **Source snippets** — focal node first, truncated to fit the token budget\n- **Backend packages** — all `composer.json` dependencies with versions, dev flag\n- **Frontend packages** — all `package.json` dependencies with versions, dev flag\n\n---\n\n### Generate AI assistant rules files\n\nPopulate context files for your AI coding tools directly from the scan data.\n\n**From the UI:** Toolbar → **Export** → **Generate AI Rules** → select targets → **Generate**.\n\n**From the terminal:**\n\n```bash\n# Generate all 7 files at once\nphp artisan brain:generate-rules\n\n# Specific targets only\nphp artisan brain:generate-rules --target=claude --target=cursor\n\n# Preview paths without writing anything\nphp artisan brain:generate-rules --dry-run\n\n# Overwrite existing files without prompting\nphp artisan brain:generate-rules --force\n```\n\n| Target | File written | Used by |\n|--------|-------------|---------|\n| `claude` | `CLAUDE.md` | Claude Code CLI & IDE extension |\n| `cursor` | `.cursor\u002Frules\u002Flaravel-brain.mdc` | Cursor (MDC format with frontmatter) |\n| `windsurf` | `.windsurf\u002Frules\u002Flaravel-brain.md` | Windsurf by Codeium |\n| `copilot` | `.github\u002Fcopilot-instructions.md` | GitHub Copilot (applied repo-wide) |\n| `junie` | `.junie\u002Fguidelines.md` | JetBrains AI \u002F Junie |\n| `aider` | `CONVENTIONS.md` | Aider (`aider --read CONVENTIONS.md`) |\n| `agents` | `AGENTS.md` | Universal open standard — 60+ tools |\n\nEach generated file contains your project's tech stack, architecture counts, top routes, complexity hotspots, detected code smells, and full package lists. Re-run after every scan to keep the files current.\n\n---\n\n### Watch mode\n\nRe-scan automatically whenever a PHP file changes:\n\n```bash\nphp artisan brain:scan --watch\nphp artisan brain:scan --watch --interval=5   # poll every 5 seconds (default: 3)\n```\n\n### Open the viewer\n\nNavigate to `\u002F_laravel-brain` in your browser while your Laravel app is running (e.g. via `php artisan serve`).\n\n## How It Works\n\n```\nphp artisan brain:scan\n        │\n        ├─ RouteAnalyzer      → scans all files in routes\u002F**\u002F*.php\n        ├─ MiddlewareAnalyzer → reads Kernel.php or bootstrap\u002Fapp.php\n        ├─ ControllerAnalyzer → resolves controller classes + methods\n        ├─ MethodTracer       → deep-traces call chains (services, repos, models)\n        ├─ ModelAnalyzer      → extracts Eloquent relationships\n        ├─ QueryTracer        → surfaces DB queries per method\n        ├─ ConsoleAnalyzer    → discovers Artisan commands and scheduled tasks\n        ├─ ChannelAnalyzer    → discovers broadcast channels\n        ├─ FilamentAnalyzer   → discovers panels, resources, pages, widgets, relation managers\n        └─ GraphBuilder       → assembles nodes + edges, flags fat classes\n                │\n                └─ Writes JSON → storage\u002Fapp\u002Flaravel-brain\u002F\n\nGET \u002F_laravel-brain\n        │\n        └─ BrainController → serves the React SPA + graph JSON via Laravel routes\n```\n\n### Route discovery\n\nLaravelBrain recursively scans your entire `routes\u002F` directory — not just `web.php` and `api.php`. Any PHP file under `routes\u002F**` is analyzed, including versioned files like `routes\u002Fv1\u002Fusers.php` or module-specific files like `routes\u002Fmodules\u002Fadmin.php`.\n\n### Call chain tracing\n\nFrom each controller action (and Filament page method), the tracer follows:\n- Direct method calls to injected services\u002Frepositories\n- Static calls (`MyService::method()`)\n- Job dispatches (`dispatch(new SendEmail(...))`)\n- Event dispatches (`event(new OrderPlaced(...))`)\n\nThis produces the full edge list used to build the graph.\n\n### Filament PHP support\n\nWhen Filament is installed, the scanner discovers every panel registered via service providers, then resolves its resources, pages, widgets, and relation managers — both explicitly listed (`->resources([...])`) and auto-discovered (`->discoverResources(for: '...')`). Filament page methods are traced through the same call-chain engine as controller actions, so models and services they touch appear in the graph.\n\n## Graph Node Types\n\n| Node | Accent Color | Represents |\n|------|-------------|------------|\n| Route | Green `#4CAF50` | HTTP endpoint (`GET \u002Fusers`) |\n| Middleware | Orange `#FF9800` | Middleware applied to a route |\n| Controller | Blue `#2196F3` | Controller class |\n| Action | Light Blue `#03A9F4` | Controller method |\n| Service | Purple `#9C27B0` | Service or helper class |\n| Model | Red `#F44336` | Eloquent model |\n| Event | Yellow `#FFD600` | Laravel event |\n| Job | Slate `#607D8B` | Queued job |\n| Filament Panel | Violet `#7C3AED` | Filament panel definition |\n| Filament Resource | Purple `#A855F7` | Filament resource class |\n| Filament Page | Lavender `#C084FC` | Filament page class |\n| Filament Page Method | Pink `#E879F9` | Method on a Filament page |\n| Filament Widget | Cyan `#06B6D4` | Filament widget class |\n| Filament Relation Manager | Teal `#0891B2` | Filament relation manager |\n\n> **Note:** Command, Schedule, Channel, and Repository nodes are discovered and added to the graph but use the closest matching accent color from their parent type.\n\n## Viewer Shortcuts\n\n| Action | How |\n|--------|-----|\n| Zoom | Scroll wheel |\n| Pan | Click + drag on canvas |\n| Inspect node | Click any node |\n| View source | Click a node → Source tab in sidebar |\n| Source popup | Click ⤢ in source section to open focused view |\n| View flowchart | Click a class node → Flow tab |\n| Flowchart popup | Click ⤢ in flow section to open large view |\n| View sequence diagram | Click a route node → Sequence Diagram section in sidebar |\n| Filter by type | Filter panel on the left |\n| Fit all nodes | Toolbar → Fit button |\n| Export PNG | Toolbar → Export → Download PNG |\n| Export Mermaid | Toolbar → Export → Copy Mermaid Code |\n| Generate AI rules | Toolbar → Export → Generate AI Rules |\n| Toggle theme | Toolbar → ☀️ \u002F 🌙 button |\n| Copy AI context | Click any node → 🤖 button in sidebar header |\n| Stress test a route | Click a **route** node → open **Stress Test** in the sidebar → set options → **Run** |\n\n## Routes Registered\n\nThe package registers the following routes in your application (all under the `\u002F_laravel-brain` prefix):\n\n```\nGET  \u002F_laravel-brain                          → Interactive graph viewer (SPA)\nGET  \u002F_laravel-brain\u002Fapi\u002Fsource               → Returns PHP source file content\nPOST \u002F_laravel-brain\u002Fapi\u002Fscan                 → Triggers a full project scan\nGET  \u002F_laravel-brain\u002Fapi\u002Fcontext              → Exports a deterministic AI context snapshot\nPOST \u002F_laravel-brain\u002Fapi\u002Fgenerate-rules       → Generates AI assistant rules files\nPOST \u002F_laravel-brain\u002Fapi\u002Fstress-test          → Starts a stress-test job (or returns sync result)\nGET  \u002F_laravel-brain\u002Fapi\u002Fstress-test\u002F{id}     → Polls background job status\u002Fresults\nGET  \u002F_laravel-brain\u002Fassets\u002F*                 → Serves frontend static assets\nGET  \u002F_laravel-brain\u002F.graph-*.json            → Serves graph data written by the scan\n```\n\nStress testing uses [`laramint\u002Flaravel-stress`](https:\u002F\u002Fgithub.com\u002FLaraMint\u002Flaravel-stress), which is installed automatically as a dependency. Target URLs are validated server-side against an allowlist of development hosts: `localhost`, `127.0.0.1`, `*.test`, `*.local`, `*.ddev.site`, single-label Docker service names (e.g. `nginx`, `app`), private IPv4 ranges (`10.x`, `172.16–31.x`, `192.168.x`), and the host in `APP_URL`.\n\n### Docker and stress testing\n\n> **Docker?** The stress test subprocess runs **inside** the container — `localhost:8080` is the host-side mapped port and won't be reachable there. Change the **Base URL** field to the internal service address, e.g. `http:\u002F\u002Fnginx` or `http:\u002F\u002Flocalhost:80`.\n\nSingle-label hostnames (Docker service names with no dots) and private IPv4 ranges are automatically allowed by the host validator, so pointing the Base URL at your internal network address will work without any extra config.\n\n## Output Files\n\nAfter running `brain:scan`, the following files are written to `storage\u002Fapp\u002Flaravel-brain\u002F`:\n\n```\n.graph-manifest.json   — Tab manifest (list of all route tabs)\n.graph-all.json        — Full combined graph (all routes)\n.graph-{tab-id}.json   — Per-route subgraph (one per route)\n```\n\nThese files are regenerated on every scan and are safe to gitignore:\n\n```gitignore\nstorage\u002Fapp\u002Flaravel-brain\u002F\n```\n\n## Security\n\nThe `\u002F_laravel-brain` routes are only registered in the `local` environment by default. Since it's a `require-dev` dependency, it will not be present in production builds (`composer install --no-dev`).\n\nIf you do install it in a non-production environment accessible over a network, consider protecting the routes with middleware.\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FLaraMint\u002Flaravel-brain\ncd laravel-brain\ncomposer install\ncd frontend && npm install && npm run dev\n```\n\nTests:\n\n```bash\ncomposer test\n```\n\n## License\n\nMIT — see [LICENSE](LICENSE) for details.\n","LaraMint\\LaravelBrain 是一个用于将 Laravel 应用程序的请求生命周期可视化为交互式图表的工具。它能够自动分析代码库，并以图形方式展示路由、控制器、服务、模型、任务、事件、命令和通道之间的连接关系，无需任何配置即可快速理解应用架构。项目支持 Laravel 9 至 13 版本以及 PHP 8.0 及以上版本，具有全生命周期追踪、Filament PHP 支持、Artisan 命令发现、计划任务可视化、广播频道映射等功能。此外，它还能检测大型类文件、计算圈复杂度，并提供方法流程图和序列图等高级视图功能。此工具非常适合需要对现有 Laravel 项目进行深入理解和维护的开发者使用。",2,"2026-06-11 02:42:22","CREATED_QUERY"]