PHPackages                             sethphat/eloquent-docs - 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. [Database &amp; ORM](/categories/database)
4. /
5. sethphat/eloquent-docs

ActiveLibrary[Database &amp; ORM](/categories/database)

sethphat/eloquent-docs
======================

Generate PHPDoc scope for your Eloquent models (columns, accessors and more)

2.0.1(2y ago)5264.5k↓12.5%9[2 issues](https://github.com/sethsandaru/eloquent-docs/issues)[5 PRs](https://github.com/sethsandaru/eloquent-docs/pulls)1MITPHPPHP ^8.2|^8.3

Since Aug 21Pushed 1y ago2 watchersCompare

[ Source](https://github.com/sethsandaru/eloquent-docs)[ Packagist](https://packagist.org/packages/sethphat/eloquent-docs)[ RSS](/packages/sethphat-eloquent-docs/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (16)Used By (1)

Laravel Eloquent phpDoc Generator
=================================

[](#laravel-eloquent-phpdoc-generator)

[![codecov](https://camo.githubusercontent.com/ae11657a93c76e1dd0edc90809eb94384bd8b3125c397f55575dc6629b2f0419/68747470733a2f2f636f6465636f762e696f2f67682f7365746873616e646172752f656c6f7175656e742d646f63732f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d374b575730534b463950)](https://codecov.io/gh/sethsandaru/eloquent-docs)[![Latest Stable Version](https://camo.githubusercontent.com/33927da57ee60ac3101c03b4148a3c48f6ffcbd1d5e12b3905567614acb526cb/687474703a2f2f706f7365722e707567782e6f72672f73657468706861742f656c6f7175656e742d646f63732f76)](https://packagist.org/packages/sethphat/eloquent-docs)[![Total Downloads](https://camo.githubusercontent.com/da21b73e42e225a5032a4280fc22da6584fab368953aed44651a23e757589c6a/687474703a2f2f706f7365722e707567782e6f72672f73657468706861742f656c6f7175656e742d646f63732f646f776e6c6f616473)](https://packagist.org/packages/sethphat/eloquent-docs)[![Build and test [MYSQL]](https://github.com/sethsandaru/eloquent-docs/actions/workflows/build_mysql.yaml/badge.svg?branch=main)](https://github.com/sethsandaru/eloquent-docs/actions/workflows/build_mysql.yaml)[![Build and test [SQLite]](https://github.com/sethsandaru/eloquent-docs/actions/workflows/build_sqlite.yaml/badge.svg?branch=main)](https://github.com/sethsandaru/eloquent-docs/actions/workflows/build_sqlite.yaml)[![Build and test [PostgreSQL]](https://github.com/sethsandaru/eloquent-docs/actions/workflows/build_postgresql.yaml/badge.svg?branch=main)](https://github.com/sethsandaru/eloquent-docs/actions/workflows/build_postgresql.yaml)[![Build on specific PHP & Laravel versions](https://github.com/sethsandaru/eloquent-docs/actions/workflows/build_laravel.yaml/badge.svg)](https://github.com/sethsandaru/eloquent-docs/actions/workflows/build_laravel.yaml)

Quickly generate the phpDoc for your Eloquent Model. Make your Eloquent super friendly with IDEs (eg PHPStorm).

And maintaining the phpDoc of your models don't have to be a pain in the ass, should be:

- Fun
- Fast
- Reliable

And, welcome to Eloquent phpDoc Generator, which going to help you to achieve the 3 points above 🎉

What will Eloquent phpDoc Generator will generate?
--------------------------------------------------

[](#what-will-eloquent-phpdoc-generator-will-generate)

- Table name
- Table columns (with correct types - including Casting types 😎)
- Model relationships
- Model attributes/accessors

Available For / Requirements
----------------------------

[](#available-for--requirements)

- **v2.x**: Laravel 11, PHP 8.2+.
- **v1.x**: Laravel 9/10, PHP 8.0, 8.1.

Install
-------

[](#install)

Install as dev-dependencies is enough, since you are only going to use this command on `local/development` env.

```
composer require sethphat/eloquent-docs --dev
```

Laravel auto-discovery will automatically do the magic for you.

Use the command
---------------

[](#use-the-command)

```
php artisan eloquent:phpdoc "App\Models\User" # view only
php artisan eloquent:phpdoc "App\Models\User" --write # view & write to file
php artisan eloquent:phpdoc "App\Models\User" --short-class # new option - use short class instead of full namespace path

# from v1.2.0
php artisan eloquent:bulk-phpdoc "app/Models/*.php" # bulk generation (force write mode)
```

Result:

Details```
====== Start PHPDOC scope of App\Models\User
/**
* Table: users
*
* === Columns ===
* @property int $id
* @property string $name
* @property string $email
* @property \Carbon\Carbon|null|null $email_verified_at
* @property string $password
* @property string|null $remember_token
* @property \Carbon\Carbon|null $created_at
* @property \Carbon\Carbon|null $updated_at
*
* === Relationships ===
* @property-read \App\Models\Emails[]|\Illuminate\Database\Eloquent\Collection|null $emails
* @property-read \App\Models\UserDetails|null $userDetail
*
* === Accessors/Attributes ===
* @property-read string $full_name
* @property-read string $is_admin
* @property-read string $user_type
* @property-read int $total_salary
* @property-read mixed $levels
* @property-read mixed $first_name
* @property-read mixed $last_name
*/
====== End PHPDOC scope of App\Models\User
Wrote phpDoc scope to //app/Models/User.php
Thank you for using EloquentDocs!
```

Best practices
--------------

[](#best-practices)

- Use `$casts` in your model, in order to help EloquentPhpDoc generate better types for you (array, date, datetime,...)
- For `get*Attribute` accessor, always declare the return type

Note: for Eloquent new `Attribute` class utilize the data via Closure, making it impossible to acquire the return types. For this case, EloquentDocs will always return `mixed`

Release logs
------------

[](#release-logs)

- v1.0.0
    - First version
    - View &amp; Update phpDoc for a single Model at a time
- v1.1.0
    - `--short-class`
    - Fixed some issues
- v1.1.1
    - Fixed issue when generating a table that has `enum` column
- v1.1.2
    - Fixed issue when first-time install the library that made Laravel discovery went wrong.
- v1.1.3 &amp; v1.1.4
    - Improved the indents
    - Supported Laravel 10
    - Deprecated Laravel 8
    - Deprecated PHP 8.0
- v1.2.0
    - New command to bulk generate from a given model path.
        - `php artisan eloquent:bulk-phpdoc "app/Models/*.php"`
    - Fixed an issue where accessors/attributes being generated as snake\_case. Should be camelCase.
- v2.0.0
    - Supports Laravel 11 + PHP 8.2/8.3
    - DBAL as required dependencies
    - Better date/datetime parsing (Carbon &amp; Carbon immutable)
    - Better boolean parsing

Contribute to the library
-------------------------

[](#contribute-to-the-library)

Feel free to fork this library and sending a PR here.

Note: all the contributions need to follow PSR-12 and cover everything under unit testing.

LICENSE
-------

[](#license)

MIT License

Made by
-------

[](#made-by)

- [Seth Phat](https://github.com/sethsandaru)
- And contributors

(Sponsered Content) Introducing RenderPDF.io - Render your PDF in seconds
-------------------------------------------------------------------------

[](#sponsered-content-introducing-renderpdfio---render-your-pdf-in-seconds)

[![RenderPDF.io](https://github.com/shipsaas/docking/raw/main/.github/render-pdf-io.png)](https://github.com/shipsaas/docking/raw/main/.github/render-pdf-io.png)

[RenderPDF.io](https://renderpdf.io) is a Render-PDF-as-a-Service that provides developer-friendly APIs to render your HTML content to modern PDFs file sin seconds 😎.

All you have to do is get your API Key and send RenderPDF.io an API call 🚀, no infrastructure setup, no overhead and hassle-free integration 🔋.

Get your free API Key today: [Sign Up to RenderPDF.io](https://renderpdf.io)

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 97.3% 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 ~62 days

Recently: every ~90 days

Total

11

Last Release

736d ago

Major Versions

1.2.3 → 2.0.02024-04-20

PHP version history (2 changes)1.0.0PHP ^8

2.0.0PHP ^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac3f098d85bb371388a3ad370678da627a3cbc53c3b107f4fd6bf46f1ce583e3?d=identicon)[sethsandaru](/maintainers/sethsandaru)

---

Top Contributors

[![sethsandaru](https://avatars.githubusercontent.com/u/23478115?v=4)](https://github.com/sethsandaru "sethsandaru (36 commits)")[![siarheipashkevich](https://avatars.githubusercontent.com/u/7753600?v=4)](https://github.com/siarheipashkevich "siarheipashkevich (1 commits)")

---

Tags

eloquentlaravelphpphpdoc

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sethphat-eloquent-docs/health.svg)

```
[![Health](https://phpackages.com/badges/sethphat-eloquent-docs/health.svg)](https://phpackages.com/packages/sethphat-eloquent-docs)
```

###  Alternatives

[tpetry/laravel-postgresql-enhanced

Support for many missing PostgreSQL specific features

9982.0M14](/packages/tpetry-laravel-postgresql-enhanced)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58723.9M36](/packages/scienta-doctrine-json-functions)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11120.2M21](/packages/anourvalar-eloquent-serialize)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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