Filament
In development, not on Packagist yet
The plugin described on this page is not published. chrisabner/cordon-modulith-filament cannot be installed with Composer today, and the snippets below show how it is meant to work once it is released. What exists now is the part of Cordon Modulith it relies on: Cordon\Laravel\Architecture::graph() and docs(), which stay @internal until the plugin is published (see compatibility).
The Filament plugin shows the modules of your application inside a Filament panel: a table with their namespace, dependencies, violations and owner, the dependency graph, and the card cordon:docs writes for each module.
It is a separate package, chrisabner/cordon-modulith-filament, so Cordon Modulith itself keeps no dependency on Filament. It needs Cordon Modulith 0.5 or later, Laravel 12 or 13, and Filament 3.2 or later or Filament 4.
Installation
Future, not available yet:
composer require chrisabner/cordon-modulith-filamentThen register the plugin in your panel provider:
use ChrisAbner\CordonFilament\CordonPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(CordonPlugin::make());
}The pages
| Page | What it shows |
|---|---|
| Modules | One row per module: namespace, depends_on, violations and the owner of its metadata. Each name opens its card. |
| Module graph | The dependency graph, drawn with Mermaid. Arrows with violations are red, dotted arrows are listeners. |
| Module | The card of cordon:docs: diagram, components, public API, what the module uses and what uses it, events and violations. |
The pages read the same analysis as cordon:verify. If config/cordon.php has errors, or no module is found, they show those problems, with the messages of the command, instead of an empty graph. The table and the graph apply the baseline. The card lists every violation in the code, as cordon:docs does.
Options
CordonPlugin::make()
->navigationGroup('Architecture')
->authorizeUsing(fn () => auth()->user()?->isAdmin())
->mermaidUrl('/vendor/mermaid/mermaid.esm.min.mjs');navigationGroup()puts the navigation items in a group.authorizeUsing()limits who may open the pages. By default everyone who can open the panel can.mermaidUrl()is the script that draws the graphs, Mermaid 11 from jsDelivr by default. Serve your own copy if the panel has a content security policy. If the script does not load, the pages show the source of the diagram.
Every page load analyses the project again. On a large codebase set the cache key, so only the files that changed are parsed.
For plugin authors
The plugin uses Cordon\Testing\Cordon, part of the public API, for the modules, the configuration errors and the violations, and Cordon\Laravel\Architecture for the graph and the module documentation as text. Architecture becomes public API when the plugin is published.
use Cordon\Laravel\Architecture;
Architecture::graph(); // the Mermaid flowchart of cordon:graph
Architecture::graph('Billing'); // only Billing and its neighbours
Architecture::docs(); // ['README.md' => ..., 'modules/Billing.md' => ..., 'events.md' => ...]Check Cordon::configurationErrors() before you call them: they describe the configuration as it is.