PHPackages                             patressz/laravel-model-documenter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. patressz/laravel-model-documenter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

patressz/laravel-model-documenter
=================================

A Laravel package for generating model documentation.

v1.1.0(3mo ago)12.8k↑317.9%MITPHPPHP ^8.3.0|^8.4.0|^8.5.0CI passing

Since Aug 7Pushed 3mo agoCompare

[ Source](https://github.com/patressz/laravel-model-documenter)[ Packagist](https://packagist.org/packages/patressz/laravel-model-documenter)[ RSS](/packages/patressz-laravel-model-documenter/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (20)Versions (13)Used By (0)

Laravel Model Documenter
========================

[](#laravel-model-documenter)

[![Tests](https://github.com/patressz/laravel-model-documenter/actions/workflows/tests.yml/badge.svg)](https://github.com/patressz/laravel-model-documenter/actions/workflows/tests.yml)

A simple Laravel package for automatic generation of PHPDoc comments for Eloquent models. The package automatically analyzes database columns, relations, accessors, and scope methods of your models and generates properly typed PHPDoc annotations.

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 11.0+

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require patressz/laravel-model-documenter --dev
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Generate documentation for all models in the `app/Models` directory:

```
php artisan model-doc:generate
```

### Specific Model

[](#specific-model)

Generate documentation for a specific model only:

```
php artisan model-doc:generate --model=App\\Models\\User
```

### Custom Directory

[](#custom-directory)

Specify a custom directory containing models:

```
php artisan model-doc:generate --path=/path/to/your/models
```

Compare existing documentation with expected documentation (without modifying files):

```
php artisan model-doc:generate --test
```

What it Generates
-----------------

[](#what-it-generates)

The package automatically generates PHPDoc annotations for:

- **Database columns** - `@property` with correct types based on database schema
- **Casts** - Automatically detects model casts and overrides database types with cast types (e.g., `datetime`, `array`, `json`, `boolean`)
- **Relations** - `@property-read` for all relation types (hasOne, hasMany, belongsTo, etc.) - **Note: Only generates properties for relationship methods that have proper return type declarations** (e.g., `HasMany`, `BelongsTo`)
- **Accessors/Mutators** - `@property`, `@property-read` or `@property-write` depending on type (supports both old-style and new Attribute-based accessors)
- **Local Scope methods** - `@method` annotations for scope methods

Example Output
--------------

[](#example-output)

For a `User` model with a table containing `id`, `name`, `email`, `email_verified_at` columns, casts, and a `posts()` relation:

```
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Model;

/**
 * @property int $id
 * @property string $name
 * @property string $email
 * @property ?\Illuminate\Support\Carbon $email_verified_at
 * @property array $settings
 * @property ?\Illuminate\Support\Carbon $created_at
 * @property ?\Illuminate\Support\Carbon $updated_at
 * @property-read \Illuminate\Database\Eloquent\Collection $posts
 *
 * @method static \Illuminate\Database\Eloquent\Builder|User active()
 */
class User extends Model
{
    protected $casts = [
        'email_verified_at' => 'datetime',
        'settings' => 'array',
    ];

    // your model code...

    public function posts(): HasMany
    {
        return $this->hasMany(Post::class);
    }

    public function scopeActive($query)
    {
        return $query->where('active', true);
    }
}
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Patrik Strišovský](https://github.com/patressz)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance79

Regular maintenance activity

Popularity23

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Recently: every ~5 days

Total

11

Last Release

109d ago

Major Versions

v0.3.0 → v1.0.02026-02-05

PHP version history (2 changes)v0.1.0PHP ^8.3.0|^8.4.0

v1.0.0PHP ^8.3.0|^8.4.0|^8.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/27a59a5b5530a6fbaa12c7a3b755fa6e2e4d6897a400487d6a548bfcb7d7dd88?d=identicon)[patressz](/maintainers/patressz)

---

Top Contributors

[![patressz](https://avatars.githubusercontent.com/u/81393875?v=4)](https://github.com/patressz "patressz (81 commits)")

---

Tags

phplaraveldevpackagedocumentation

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/patressz-laravel-model-documenter/health.svg)

```
[![Health](https://phpackages.com/badges/patressz-laravel-model-documenter/health.svg)](https://phpackages.com/packages/patressz-laravel-model-documenter)
```

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M102](/packages/dedoc-scramble)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/surveyor

Static analysis tool for Laravel applications.

86121.4k13](/packages/laravel-surveyor)[deptrac/deptrac

Deptrac is a static code analysis tool that helps to enforce rules for dependencies between software layers.

3.0k8.8M119](/packages/deptrac-deptrac)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1882.3M44](/packages/dereuromark-cakephp-ide-helper)[elegantly/laravel-translator

All on one translations management for Laravel

6333.1k](/packages/elegantly-laravel-translator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
