Download the PHP package giacomomasseron/laravel-models-generator without Composer
On this page you can find all versions of the php package giacomomasseron/laravel-models-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download giacomomasseron/laravel-models-generator
More information about giacomomasseron/laravel-models-generator
Files in giacomomasseron/laravel-models-generator
Package laravel-models-generator
Short Description Generate Laravel models from an existing database
License MIT
Homepage https://github.com/giacomomasseron/laravel-models-generator
Informations about the package laravel-models-generator
Generate Laravel models from an existing database
Compatible with Laravel 9/10/11/12/13.
Major features:
- PHPStan level 9/10 compliant
- Laravel 11/12/13 style (using new models attributes)
- Polymorphic relationships
- Uuids / Ulids columns
- Enums casting
- URI casting
- JSON casting
Drivers supported
- MariaDB
- MySQL
- SQLite
- PostgreSQL
- SQLServer
Coming soon ... all drivers supported by doctrine/dbal.
Installation
You can install the package via composer:
Usage / Generate models
For basic usage, you can generate models with the command:
Factories
The package can generate factories for your models.
The factories will be created in database/factories directory, and they use standard Laravel fake functions to fill fields.
You can generate model factories with the command:
or
Other usages
To generate models from a specific connection:
To generate models from a specific schema:
To generate a single table:
Config
You can publish the config file with:
This is the contents of the published config file:
Polymorphic relationships
To add polymorphic relationships to your models, you can use morphs array in the config file.
If you have tables like this:
And config file like this:
This relationship will be created in the Image model:
This relationship will be created in the Post model:
Interfaces
If you want your models implement interface(s), use interfaces value in config:
Traits
If you want your models use trait(s), use traits value in config:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Giacomo Masseroni
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-models-generator with dependencies
composer/semver Version ^3.4
doctrine/dbal Version ^3.7||^4.4
illuminate/contracts Version ^9.0||^10.0||^11.0||^12.0||^13.0
spatie/laravel-package-tools Version ^1.16