quatrebarbes/larchiclass

Some architecture-related commands for Laravel developers
1,000
Install
composer require quatrebarbes/larchiclass
Latest Version:v1.0.5
PHP:^8.1
License:MIT
Last Updated:Apr 12, 2026
Links: GitHub  ·  Packagist
Maintainer: quatrebarbes

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 .puml file 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 $fillable and $hidden is rendered as private
  • 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

laboiteacode/filament-dependency-graph

The visual architecture explorer for Filament. Explore models, resources, panels...

3,284 2
phpno1/architecture

an architecture for laravel

2,025 63
spatie/laravel-sluggable

Generate slugs when saving Eloquent models

14,569,030 1,556
hootlex/laravel-friendships

This package gives Eloquent models the ability to manage their friendships.

127,204 698
kodeine/laravel-acl

Light-weight role-based permissions for Laravel 5 built in Auth system.

364,706 775