Export the module graph
php artisan larch:graph exports the graph of modules from the running app.
Package discovery registers the command.
See the graph in a browser
Section titled “See the graph in a browser”php artisan larch:graph --htmlLarch writes larch-graph.html at the project root. Open it in a browser. It needs no network.
The report draws the modules and their links, turns each kind of link on and off, and lists every link and unknown link.
To write it somewhere else:
php artisan larch:graph --html --output=build/graph.htmlFeed the graph to another tool
Section titled “Feed the graph to another tool”php artisan larch:graph --json > graph.jsonJSON is the default, so --json is optional. Mortise reads this format.
The fields are in the graph format reference.
Pass your configuration
Section titled “Pass your configuration”Artisan does not read tests/Pest.php. Give the configuration as options when it is not the default:
php artisan larch:graph \ --modules='App\Modules\*' \ --paths=app --paths=Modules \ --public-api=Contracts --public-api=EventsRead the code only
Section titled “Read the code only”To skip booting the app and read imports only:
php artisan larch:graph --imports-onlyList the links Larch cannot follow
Section titled “List the links Larch cannot follow”Unknown links, such as app($class) or a binding closure with no return type, are in the unknown list of the JSON and in the report.
To make Larch follow a binding, see Let Larch follow your bindings.