Download the PHP package patressz/laravel-model-documenter without Composer
On this page you can find all versions of the php package patressz/laravel-model-documenter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-model-documenter
Laravel Model Documenter
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
- PHP 8.3+
- Laravel 11.0+
Installation
Install the package via Composer:
Usage
Basic Usage
Generate documentation for all models in the app/Models directory:
Specific Model
Generate documentation for a specific model only:
Custom Directory
Specify a custom directory containing models:
Compare existing documentation with expected documentation (without modifying files):
What it Generates
The package automatically generates PHPDoc annotations for:
- Database columns -
@propertywith 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-readfor 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-reador@property-writedepending on type (supports both old-style and new Attribute-based accessors) - Local Scope methods -
@methodannotations for scope methods
Example Output
For a User model with a table containing id, name, email, email_verified_at columns, casts, and a posts() relation:
Contributing
Please see CONTRIBUTING for details.
Credits
- Patrik Strišovský
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-model-documenter with dependencies
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
nikic/php-parser Version ^5.0
phpstan/phpdoc-parser Version ^2.0