PHPackages                             dev-lnk/laravel-code-builder - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dev-lnk/laravel-code-builder

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dev-lnk/laravel-code-builder
============================

Generate classes and files from table schema

v1.2(1y ago)194.7k↓50%2MITPHPPHP ^8.2

Since Apr 30Pushed 1y ago3 watchersCompare

[ Source](https://github.com/dev-lnk/laravel-code-builder)[ Packagist](https://packagist.org/packages/dev-lnk/laravel-code-builder)[ RSS](/packages/dev-lnk-laravel-code-builder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (19)Used By (0)

Generating laravel code from SQL table schema
=============================================

[](#generating-laravel-code-from-sql-table-schema)

[![Latest Stable Version](https://camo.githubusercontent.com/e5a53e1e1a98efbc270b7827c0ee14fdcf1b592e101394169f96ba485ee84134/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465762d6c6e6b2f6c61726176656c2d636f64652d6275696c646572)](https://packagist.org/packages/dev-lnk/laravel-code-builder)[![Total Downloads](https://camo.githubusercontent.com/800f095acd90cc66cdc0badc8df5767e5016466324f8986eaad451fa7cf579d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465762d6c6e6b2f6c61726176656c2d636f64652d6275696c646572)](https://packagist.org/packages/dev-lnk/laravel-code-builder)[![tests](https://github.com/dev-lnk/laravel-code-builder/workflows/tests/badge.svg)](https://github.com/dev-lnk/laravel-code-builder/actions)[![License](https://camo.githubusercontent.com/5bac15e11ff0c7dd4564b5b5c20909c326e4b4a74ebf081e7fe950d57e958e6d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6465762d6c6e6b2f6c61726176656c2d636f64652d6275696c646572)](https://packagist.org/packages/dev-lnk/laravel-code-builder)
[![Laravel required](https://camo.githubusercontent.com/67ff25342790de50f83c6313acb28d5fdd1d7931a63bf481f21ea769b7b1ca1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302b2d4646324432303f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c)](https://laravel.com)[![PHP required](https://camo.githubusercontent.com/233addbd8bc6c491cd7a929fd0305ab4d0144a078f8f346dfeb9421d929ac128/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322b2d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870)](https://www.php.net/manual/)

### Description

[](#description)

Hello Laravel users! This package allows you to generate code from the schema of your SQL table. The following entities will be generated:

- [Controller](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/examples/controller.md)
- [Model](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/examples/model.md)
- [FormRequest](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/examples/request.md)
- [DTO](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/examples/dto.md)
- [AddAction](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/examples/add_action.md)
- [EditAction](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/examples/edit_action.md)
- [Route](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/examples/route.md)
- [Form](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/examples/form.md)
- [Table](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/examples/table.md)

These examples have been generated from a table created by migration:

```
Schema::create('products', function (Blueprint $table) {
    $table->id();
    $table->string('title')->default('Default');
    $table->text('content');
    $table->foreignIdFor(User::class)
        ->nullable()
        ->constrained()
        ->nullOnDelete()
        ->cascadeOnUpdate();
    $table->smallInteger('sort_number')->default(0);
    $table->boolean('is_active')->default(0);
    $table->timestamps();
    $table->softDeletes();
});
```

### What is this package for?

[](#what-is-this-package-for)

This package allows you to significantly reduce the routine while coding and focus on developing.

### Installation

[](#installation)

```
composer require dev-lnk/laravel-code-builder --dev
```

### Configuration:

[](#configuration)

Publish the package configuration file:

```
php artisan vendor:publish --tag=laravel-code-builder
```

### Usage

[](#usage)

The basic command signature looks like this:

```
code:build {entity} {table?}
```

Let's say we want to create classes for the base table `users` based on the `User` entity. To do this you need to run the following command:

```
php artisan code:build User
```

You will be presented with a list of your tables, choose which table you want to generate the code based on:

```
 ┌ Table ───────────────────────────────────────────────────────┐
 │   ○ migrations                                             │ │
 │   ○ password_reset_tokens                                  │ │
 │   ○ products                                               │ │
 │   ○ sessions                                               │ │
 │ › ● users                                                  ┃ │
 └──────────────────────────────────────────────────────────────┘
```

You can also specify part of the table name to shorten the list

```
php artisan code:build User us
 ┌ Table ───────────────────────────────────────────────────────┐
 │ › ● users                                                    │
 └──────────────────────────────────────────────────────────────┘
```

If you have not specified a `generation_path` in the configuration file, you will be offered 2 options:

```
 ┌ Where to generate the result? ───────────────────────────────┐
 │ › ● In the project directories                               │
 │   ○ To the generation folder: `app/Generation`               │
 └──────────────────────────────────────────────────────────────┘
```

The first option will create all files according to the folders in your `app_path` directory. If a file with the same name is found, you will be prompted to replace it:

```
app/Models/User.php was created successfully!
...
 ┌ Controller already exists, are you sure you want to replace it? ┐
 │ Yes                                                             │
 └─────────────────────────────────────────────────────────────────┘

app/Http/Controllers/UserController.php was created successfully!
...
```

In the second option, all files will be generated in the `app/Generation` folder

```
app/Generation/Models/User.php was created successfully!
...
```

In the `builders` configuration you can comment out those builders that you do not want to be executed

```
return [
    'builders' => [
        'model',
//        'addAction',
//        'editAction',
//        'request',
//        'controller',
//        'route',
        'form',
//        'DTO',
//        'table',
    ],
    //...
];
```

You can generate certain entities using flags:

```
php artisan code:build user --model --request
```

Available options for the only flag:

- `--model`
- `--request`
- `--DTO`
- `--addAction`
- `--editAction`
- `--controller`
- `--route`
- `--form`
- `--table`
- `--typeScript`
- `--builder` - Generates all builders specified in the `builders` configuration + your specified flag, for example:

```
php artisan code:build user --builders --request
```

### Documentation

[](#documentation)

- **[Relationship](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/relationship.md)**
- **[Customization](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/customization.md)**
- **[For contributors](https://github.com/dev-lnk/laravel-code-builder/blob/master/docs/for_contributors.md)**

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

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

Recently: every ~24 days

Total

17

Last Release

630d ago

Major Versions

v0.9.3 → v1.0.02024-05-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/05a527a4668ba463f5dd369f8d80a08dc609286bafe3d335fef4def6a32d5e63?d=identicon)[dev-lnk](/maintainers/dev-lnk)

---

Top Contributors

[![dev-lnk](https://avatars.githubusercontent.com/u/24544581?v=4)](https://github.com/dev-lnk "dev-lnk (133 commits)")

---

Tags

laravelschemageneration

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dev-lnk-laravel-code-builder/health.svg)

```
[![Health](https://phpackages.com/badges/dev-lnk-laravel-code-builder/health.svg)](https://phpackages.com/packages/dev-lnk-laravel-code-builder)
```

###  Alternatives

[okipa/laravel-table

Generate tables from Eloquent models.

56752.8k](/packages/okipa-laravel-table)[stephenjude/filament-blog

Filament Blog Builder

20317.8k](/packages/stephenjude-filament-blog)[okipa/laravel-form-components

Ready-to-use and customizable form components.

198.0k1](/packages/okipa-laravel-form-components)[elaniin/findable

An SEO add-on for Statamic.

131.4k](/packages/elaniin-findable)

PHPackages © 2026

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