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.

4.1.1(3w ago)2053.1k↑83.3%5[6 issues](https://github.com/RonasIT/laravel-entity-generator/issues)[5 PRs](https://github.com/RonasIT/laravel-entity-generator/pulls)MITPHPPHP ^8.3CI passing

Since Aug 15Pushed 2w 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 3d ago

READMEChangelog (10)Dependencies (57)Versions (86)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\EntityGenerator\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:

TypeShort OptionFull Option`integer``-i``--integer``float``-f``--float``string``-s``--string``boolean``-b``--boolean``datetime``-t``--timestamp``json``-j``--json`#### Fields modifiers

[](#fields-modifiers)

To set a special behavior for the field use the modifiers syntax. Modifiers may be passed using a `:` symbol in the field definition. Multiple modifiers can be combined with a comma.

```
php artisan make:entity Post -s title:required,unique -s text -t published_at:required
```

Each modifier has full and short syntax. The list of available modifiers defined in the table:

ModifierShort syntaxDescription`required``r`Disallow to set `null` as a field value. Add required validation rule for creation, `filled` validation for the update, and not null in migration`unique``u`Add a unique index in migration and unique validation rule for creation and update#### Reserved field names

[](#reserved-field-names)

The following field names are reserved and **cannot be passed as input fields** because they are managed automatically by Laravel and the generator:

FieldReason`id`Primary key, added by Laravel automatically`created_at`Timestamp, managed by Eloquent`updated_at`Timestamp, managed by Eloquent#### 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`
- `resources`
- `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

65

—

FairBetter than 99% of packages

Maintenance90

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity93

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

Recently: every ~4 days

Total

58

Last Release

23d 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

3.x-dev → 4.0.02026-03-30

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

1.3.7PHP ^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 (402 commits)")[![artengin](https://avatars.githubusercontent.com/u/152782500?v=4)](https://github.com/artengin "artengin (186 commits)")[![RGO230](https://avatars.githubusercontent.com/u/76399317?v=4)](https://github.com/RGO230 "RGO230 (125 commits)")[![AZabolotnikov](https://avatars.githubusercontent.com/u/110885041?v=4)](https://github.com/AZabolotnikov "AZabolotnikov (86 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 (24 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)")[![vitgrams](https://avatars.githubusercontent.com/u/126395087?v=4)](https://github.com/vitgrams "vitgrams (9 commits)")[![NikitaYakovlev](https://avatars.githubusercontent.com/u/36948499?v=4)](https://github.com/NikitaYakovlev "NikitaYakovlev (9 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)")[![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)")[![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)")[![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)")

---

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

[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.7M223](/packages/backpack-crud)[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[dcat-plus/laravel-admin

dcat-plus admin

1474.0k10](/packages/dcat-plus-laravel-admin)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k31](/packages/ronasit-laravel-helpers)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)

PHPackages © 2026

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