PHPackages                             ronasit/laravel-entity-generator - 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. [CLI &amp; Console](/categories/cli)
4. /
5. ronasit/laravel-entity-generator

ActiveLibrary[CLI &amp; Console](/categories/cli)

ronasit/laravel-entity-generator
================================

Provided console command for generating entities.

3.5(3mo ago)1851.4k↓37.5%4[12 PRs](https://github.com/RonasIT/laravel-entity-generator/pulls)MITPHPPHP ^8.3CI passing

Since Aug 15Pushed 1mo ago5 watchersCompare

[ Source](https://github.com/RonasIT/laravel-entity-generator)[ Packagist](https://packagist.org/packages/ronasit/laravel-entity-generator)[ RSS](/packages/ronasit-laravel-entity-generator/feed)WikiDiscussions master Synced 1mo ago

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

Laravel-Entity-Generator
========================

[](#laravel-entity-generator)

[![Coverage Status](https://camo.githubusercontent.com/a93627fe85def5ce6f1e4f7598d4be931c9272ddc7e1d36ee1c553b01a56cbab/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f526f6e617349542f6c61726176656c2d656e746974792d67656e657261746f722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/RonasIT/laravel-entity-generator?branch=master)

Laravel-Entity-Generator - This generator is used to create a standard class stack for a new entity.

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

[](#installation)

Install package using `dev` mode

```
composer require ronasit/laravel-entity-generator --dev
```

Publish package's resources.

```
php artisan vendor:publish --provider="RonasIT\Support\EntityGeneratorServiceProvider"
```

Usage
-----

[](#usage)

### Entity generation

[](#entity-generation)

Call `make:entity` artisan command to run the generation command for the full stack of the entity classes:

```
php artisan make:entity Post
```

Entity name may contain the subfolder, in this case generated `model` and `nova resource` will be placed to the subfolder as well:

```
php artisan make:entity Forum/Blog/Post
```

#### Fields definition options

[](#fields-definition-options)

The `make:entity` provides an ability to set the entity's fields, which will be used in all created classes (e.g. Model, Create/Update requests, Test fixtures, etc.)

```
php artisan make:entity Post -S title -S text -t published_at
```

The following field types are available to use:

TypeModificatorShort OptionFull Option`integer``-i``--integer``integer`required`-I``--integer-required``float``-f``--float``float`required`-F``--float-required``string``-s``--string``string`required`-S``--string-required``boolean``-b``--boolean``boolean`required`-B``--boolean-required``datetime``-t``--timestamp``datetime`required`-T``--timestamp-required``json``-j``--json`#### Relations definitions options

[](#relations-definitions-options)

Command also provides an ability to set relations, which will be added to the model

```
php artisan make:entity Post -A Comment -A Reaction
```

Relation may be placed in the subfolder, in this case - set the relative namespace from the model directory:

```
php artisan make:entity Post -A Blog/Comment -A Forum/Common/Reaction
```

The following options are available to set relations:

TypeShort OptionFull OptionHas one`-a``--has-one`Has many`-A``--has-many`Belongs to`-e``--belongs-to`Belongs to many`-E``--belongs-to-many`#### Single class generation mode options

[](#single-class-generation-mode-options)

Command allows to generate only single entity-related class

```
php artisan make:entity Post --only-tests
```

The following options are available:

- `--only-model`
- `--only-repository`
- `--only-service`
- `--only-controller`
- `--only-requests`
- `--only-migration`
- `--only-factory`
- `--only-tests`
- `--only-seeder`
- `--only-resource`
- `--only-nova-tests`

#### Mode combination options

[](#mode-combination-options)

Sometimes you need to generate the stack of classes to work with some entity only inside the application without the ability to manipulate it using API, or you need to create only API for already existed entity.

For this task, there are two mutually exclusive options:

1. `--only-entity`, generate stack of classes to work with entity only inside the app, it includes:

- `migration`
- `model`
- `service`
- `repository`

2. `--only-api`, generate stack of classes to implement API part to work with already existed entity:

- `routes`
- `controller`
- `requests`
- `tests`

#### Methods setting options

[](#methods-setting-options)

By default, the command generate all methods from the CRUD stack which includes:

- create
- update
- delete
- search
- get by id

But what if we need to create the interface only for updating and reading the entity? Just use the `methods` option for it:

```
php artisan make:entity Post --methods=RU
```

Feel free to use any combinations of actions in any order. Each action has its own character:

- `C` create
- `U` update
- `D` delete
- `R` read (search and get by id)

#### Special class-related options

[](#special-class-related-options)

- `--nova-resource-name` - Specifies the Nova resource name for the Nova tests generation. By default script will try to find the common resource class based on the entity name.

Release notes
-------------

[](#release-notes)

### 1.3

[](#13)

Since 1.3 version you need to add to your config/entity-generator.php following data:

```
    'paths' => [
        ... // your old data
        'database_seeder' => 'database/seeds/DatabaseSeeder.php',
        'translations' => 'lang/en/validation.php'
    ],
    'stubs' => [
        ... // your old data
        'empty_factory' => 'entity-generator::empty_factory',
        'translation_not_found' => 'entity-generator::translation_not_found',
        'validation' => 'entity-generator::validation',
        'seeder' => 'entity-generator::seeder',
        'database_empty_seeder' => 'entity-generator::database_empty_seeder'
    ]
```

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance86

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~60 days

Recently: every ~18 days

Total

46

Last Release

94d ago

Major Versions

1.3.10 → 2.0.0-beta2021-11-23

1.3.12 → 2.0.3-beta2022-04-22

2.0.4-beta → 3.0.0-beta2024-08-26

PHP version history (4 changes)1.1.0-betaPHP &gt;=5.6

1.3.6PHP ^7.1.3

2.0.1-betaPHP &gt;=7.1.3

3.0.0-betaPHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1585993?v=4)[Evgeny Leonov](/maintainers/eleonov)[@eleonov](https://github.com/eleonov)

![](https://avatars.githubusercontent.com/u/129854316?v=4)[DPankratov](/maintainers/DPankratov)[@dpankratov](https://github.com/dpankratov)

---

Top Contributors

[![DenTray](https://avatars.githubusercontent.com/u/9486872?v=4)](https://github.com/DenTray "DenTray (350 commits)")[![RGO230](https://avatars.githubusercontent.com/u/76399317?v=4)](https://github.com/RGO230 "RGO230 (125 commits)")[![artengin](https://avatars.githubusercontent.com/u/152782500?v=4)](https://github.com/artengin "artengin (116 commits)")[![AZabolotnikov](https://avatars.githubusercontent.com/u/110885041?v=4)](https://github.com/AZabolotnikov "AZabolotnikov (71 commits)")[![t0xas](https://avatars.githubusercontent.com/u/9395445?v=4)](https://github.com/t0xas "t0xas (50 commits)")[![aizlee](https://avatars.githubusercontent.com/u/5491378?v=4)](https://github.com/aizlee "aizlee (25 commits)")[![pirs1337](https://avatars.githubusercontent.com/u/98943794?v=4)](https://github.com/pirs1337 "pirs1337 (22 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (18 commits)")[![yogyrton](https://avatars.githubusercontent.com/u/90783599?v=4)](https://github.com/yogyrton "yogyrton (11 commits)")[![MishaMoroz](https://avatars.githubusercontent.com/u/32964665?v=4)](https://github.com/MishaMoroz "MishaMoroz (10 commits)")[![Adil9994](https://avatars.githubusercontent.com/u/32493535?v=4)](https://github.com/Adil9994 "Adil9994 (9 commits)")[![astorozhevsky](https://avatars.githubusercontent.com/u/11055414?v=4)](https://github.com/astorozhevsky "astorozhevsky (4 commits)")[![vitgrams](https://avatars.githubusercontent.com/u/126395087?v=4)](https://github.com/vitgrams "vitgrams (4 commits)")[![NikitaYakovlev](https://avatars.githubusercontent.com/u/36948499?v=4)](https://github.com/NikitaYakovlev "NikitaYakovlev (3 commits)")[![Goodmain](https://avatars.githubusercontent.com/u/1735581?v=4)](https://github.com/Goodmain "Goodmain (3 commits)")[![vzolotukhin](https://avatars.githubusercontent.com/u/102961972?v=4)](https://github.com/vzolotukhin "vzolotukhin (3 commits)")[![yburlakov](https://avatars.githubusercontent.com/u/3166802?v=4)](https://github.com/yburlakov "yburlakov (1 commits)")[![KonstantinLapkovsky](https://avatars.githubusercontent.com/u/23478901?v=4)](https://github.com/KonstantinLapkovsky "KonstantinLapkovsky (1 commits)")[![stusov](https://avatars.githubusercontent.com/u/28598627?v=4)](https://github.com/stusov "stusov (1 commits)")[![avardugin](https://avatars.githubusercontent.com/u/29125480?v=4)](https://github.com/avardugin "avardugin (1 commits)")

---

Tags

laravelentity-generator

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ronasit-laravel-entity-generator/health.svg)

```
[![Health](https://phpackages.com/badges/ronasit-laravel-entity-generator/health.svg)](https://phpackages.com/packages/ronasit-laravel-entity-generator)
```

###  Alternatives

[bfinlay/laravel-excel-seeder

Seed the database with Laravel using Excel, XLSX, XLS, CSV, ODS, Gnumeric, XML, HTML, SLK files

3944.4k](/packages/bfinlay-laravel-excel-seeder)

PHPackages © 2026

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