- How do I install LaraMint Laravel Brain?
- Install it as a dev dependency with composer require --dev laramint/laravel-brain, then run php artisan brain:scan to generate the graph. The package uses Laravel service provider auto-discovery, so no manual registration or route changes are needed. Once scanned, open /_laravel-brain in your browser to view the interactive graph.
- Which Laravel and PHP versions does Laravel Brain support?
- Laravel Brain supports Laravel 9, 10, 11, 12, and 13, and requires PHP 8.0 or newer. It is built specifically for Laravel's conventions and requires no framework modifications. Check the repository for the latest compatibility notes before upgrading major versions.
- Does Laravel Brain work in production?
- Laravel Brain is intended as a dev-only tool and should be installed with --dev so it does not add production bloat. Scans run as CLI commands and write static JSON graph files, so there is no runtime overhead in your application. The viewer is served at /_laravel-brain, so exclude that path at your web server or protect it with middleware such as auth:sanctum before exposing it outside local development.
- How do I visualize my Laravel routes, controllers, and models with Laravel Brain?
- Run php artisan brain:scan and the package traces routes through controllers, services, repositories, models, jobs, events, commands, channels, and Filament panels, then writes the graph to storage/app/laravel-brain. The interactive viewer is served through your existing Laravel routes at /_laravel-brain, so no separate server process or port is required. Open the viewer to explore the request lifecycle as a node graph.
- What happens if Laravel Brain hits memory limits on a large codebase?
- Large applications may exceed the default 1GB PHP memory limit during a scan. Use the --memory-limit flag to raise the limit, or enable auto-discover mode, which lowers memory usage by trading away some file and line metadata. Auto-discover can make programmatically registered routes harder to trace back to source files, so validate critical paths.
- Does Laravel Brain support Filament panels and resources?
- Yes, Laravel Brain integrates with Filament 2 and 3 and discovers panels, resources, pages, widgets, and relation managers. It traces call chains from Filament pages and resources into your application code. If your app does not use Filament, you can disable that analyzer to keep scans focused.
- Can I run Laravel Brain scans in CI/CD pipelines?
- Yes, you can add php artisan brain:scan to a CI job such as GitHub Actions. Use a flag like --memory-limit=2G on larger projects to avoid scan failures. Monitor scan times if you run scans on every commit, because auto-watch mode and large codebases can add noticeable overhead.
- How do I export Laravel Brain's graph for documentation or LLM context?
- Use php artisan brain:export-context --output=docs/architecture.md to export the graph context into a documentation file. This is useful for architecture docs or LLM-assisted refactoring prompts. For complex nodes, validate token budgets before feeding the output into a model.
- How does Laravel Brain compare to Laravel Telescope or Horizon?
- Laravel Brain is complementary to Telescope and Horizon rather than a replacement. Telescope and Horizon observe runtime requests, jobs, and queues, while Laravel Brain statically analyzes and visualizes your application architecture before runtime. Many teams use both: Brain for architecture maps and Telescope or Horizon for live debugging.
- Why are some routes or dispatch call chains missing from the Laravel Brain graph?
- Routes registered programmatically inside service providers may not map to source files when auto-discover mode is enabled. Dynamic calls such as call_user_func can also cause false positives or false negatives in call-chain tracing. Use the --auto-discover option for programmatic routes and manually validate critical paths that matter most.