quatrebarbes/larchiclass
Composer 安装命令:
composer require quatrebarbes/larchiclass
包简介
Some architecture-related commands for Laravel developers
README 文档
README
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>>
统计信息
- 总下载量: 349
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-01