quatrebarbes/larchiclass
| Install | |
|---|---|
composer require quatrebarbes/larchiclass |
|
| Latest Version: | v1.0.5 |
| PHP: | ^8.1 |
| License: | MIT |
| Last Updated: | Apr 12, 2026 |
| Links: | GitHub · Packagist |
LarchiClass ๐
Some architecture-related commands for Laravel developers
PHP 8.1+ ยท Laravel 10 / 11 ยท install as --dev
Generate PlantUML class diagrams from your Laravel namespaces.
LarchiClass inspects your PHP classes produces a .puml file ready to render with PlantUML. The larchi:class command covers all PHP types (classes, interfaces, traits, enums), while larchi:model enriches the diagram with Eloquent properties and model relationships.
Installation
composer require quatrebarbes/larchiclass --dev
Commands
| Command | Description |
|---|---|
larchi:caller |
Analyze all the function callers leading to a method & shdescribe the flow into a diagram. |
larchi:class |
General-purpose diagram โ classes, interfaces, traits, enums. Dependencies resolved from type hints. |
larchi:model |
Eloquent diagram โ $fillable, $casts, $hidden properties and relationships (hasMany, belongsTo, morphToโฆ). |
Examples of using larchi:caller
# Default output: larchi-caller.puml
php artisan larchi:class "App\Domain\Billing::readInvoice"
# Custom output file
php artisan larchi:class "App\Domain\Billing::readInvoice" --output="docs/billing-read-invoice.puml"
Examples of using larchi:class
# Default namespace (App), output: larchi-class.puml
php artisan larchi:class
# Custom namespace
php artisan larchi:class --namespace="App\Domain\Billing"
# Custom output file
php artisan larchi:class --output="docs/billing.puml"
# Include parents and dependencies outside the namespace
php artisan larchi:class --namespace="App\Http\Controllers" --with-related
# Include everything, vendor classes included
php artisan larchi:class --with-related --with-vendors
Example of using larchi:model
# Default namespace (App\Models), output: larchi-model.puml
php artisan larchi:model
# Specific subdomain
php artisan larchi:model --namespace="App\Models\Billing" --output="docs/billing-models.puml"
# Include Eloquent parent classes
php artisan larchi:model --with-related --with-vendors
The
.pumlfile can be rendered with PlantUML, the VS Code PlantUML extension, or any compatible tool. The diagram is left-to-right by default.
What the diagram includes
larchi:caller
- All functions/methods that call the target method directly or not
- The complete chain of callers up to http routes & artisan commands
larchi:class
- All classes, interfaces, traits, and enums in the target namespace
- Properties with type, visibility (
+#-), and{static}modifier - Methods with visibility,
{abstract}, and{static}modifiers - Inheritance arrows (
<|--), implementation arrows (<|..), trait usage (<..), and dependency arrows (..>) - Stubs for classes referenced outside the scope (with
--with-related)
larchi:model (everything from larchi:class, plusโฆ)
- Properties sourced from
$fillable,$hidden,$casts,$dates, and$appends - Computed visibility: a field present in both
$fillableand$hiddenis rendered asprivate - Types resolved from
$casts:decimal:2โdecimal,AsCollection::classโAsCollection - Eloquent relationships:
hasOne,hasMany,belongsTo,belongsToMany,hasManyThrough,hasOneThrough,morphOne,morphMany,morphTo,morphToMany,morphedByMany - Automatic cardinality (
"1" -- "*","*" -- "*", etc.) - Reciprocal pairs merged into a single arrow annotated with both method names
- Stereotypes
<<model>>,<<vendor>>,<<trait>>
Related Packages
The visual architecture explorer for Filament. Explore models, resources, panels...
This package gives Eloquent models the ability to manage their friendships.
Light-weight role-based permissions for Laravel 5 built in Auth system.