PHPackages                             sajidul-islam/laravel-crud-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. [Framework](/categories/framework)
4. /
5. sajidul-islam/laravel-crud-generator

ActiveLibrary[Framework](/categories/framework)

sajidul-islam/laravel-crud-generator
====================================

A simple Laravel CRUD generator with web interface

1.0.1(11mo ago)17204MITPHPPHP &gt;=8.0

Since May 31Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Sajid-al-islam/laravel-crud-generator)[ Packagist](https://packagist.org/packages/sajidul-islam/laravel-crud-generator)[ RSS](/packages/sajidul-islam-laravel-crud-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

Laravel CRUD Generator
======================

[](#laravel-crud-generator)

A Laravel package that lets you scaffold complete CRUD (Create, Read, Update, Delete) functionality—with models, migrations, controllers, requests, views, and routes—through a simple web-based UI or programmatically.

Features
--------

[](#features)

- **Model Generation**
    Creates an Eloquent model class with fillable properties.
- **Optional Migration Creation**
    Generates a timestamped migration file with columns based on your field definitions (string, text, integer, boolean, date, datetime, etc.), including `nullable` support.
- **Controller Generation**
    Builds a resource controller with index, create, store, edit, update, show, and destroy methods.
- **Form Request Generation**
    Generates a dedicated FormRequest class for server-side validation of your model's fields.
- **Blade View Scaffolding**
    Produces a complete set of Blade templates (`index`, `create`, `edit`, `show`) under `resources/views/{resource}`—including dynamic form inputs, tables, and detail pages.
- **Automatic Route Registration**
    Appends a `Route::resource(...)` declaration to `routes/web.php`, enabling immediate access to your new CRUD endpoints.
- **Web UI for Configuration**
    A Bootstrap- and Font Awesome-powered interface where you can:

    - Enter Model Name (PascalCase) and Table Name (snake\_case, plural).
    - Choose whether to generate a migration/seeder.
    - Define fields (name, type, validation rules, nullable).
    - Dynamically add/remove fields.
    - Load quick field templates (Blog Post, Product, User).
- **Programmatic (CLI) Usage**
    Inject `CrudGeneratorService` into your own Artisan commands to generate CRUD definitions from an array of parameters.

Requirements
------------

[](#requirements)

- PHP 8.0+
- Laravel 9.x+
- Composer
- Writable directories:
    - `app/Models/` (for models)
    - `database/migrations/` (for migrations)
    - `app/Http/Controllers/` (for controllers)
    - `app/Http/Requests/` (for form requests)
    - `resources/views/` (for views)

---

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

[](#installation)

1. **Require the Package**

    ```
    composer require sajidul-islam/laravel-crud-generator
    ```
2. **(Optional) Migrate Your Database**

    ```
    php artisan migrate
    ```

    Ensure your existing migrations are up-to-date before generating new tables.

---

Configuration
-------------

[](#configuration)

you can publish the configuration file with:

```
php artisan vendor:publish --provider="SajidUlIslam\CrudGenerator\CrudGeneratorServiceProvider"
```

Typical settings include:

- Custom namespaces for generated classes.
- Default view paths.
- List of available field types in the UI dropdown.

If no `config/crud-generator.php` appears after installation, the package works out-of-the-box with sensible defaults.

---

Usage
-----

[](#usage)

### Web UI

[](#web-ui)

[![crud-generator](https://private-user-images.githubusercontent.com/72538066/449613835-bd781b3c-db78-43e2-936a-d16809607ba0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxMjYzOTgsIm5iZiI6MTc3NTEyNjA5OCwicGF0aCI6Ii83MjUzODA2Ni80NDk2MTM4MzUtYmQ3ODFiM2MtZGI3OC00M2UyLTkzNmEtZDE2ODA5NjA3YmEwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAyVDEwMzQ1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM1NWU2ZWFiZjg2NDYzNWI0NTIxNDRkY2I5MWQ1NmExMzlkZDMxYjcwM2ExZDQ3ZDhjZDNiOWE3ODA2YjY4MjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.zCW3cIuhj_rO8OwpGgZ0EO-YkTNqje_2aW8FJgi3p_c)](https://private-user-images.githubusercontent.com/72538066/449613835-bd781b3c-db78-43e2-936a-d16809607ba0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxMjYzOTgsIm5iZiI6MTc3NTEyNjA5OCwicGF0aCI6Ii83MjUzODA2Ni80NDk2MTM4MzUtYmQ3ODFiM2MtZGI3OC00M2UyLTkzNmEtZDE2ODA5NjA3YmEwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAyVDEwMzQ1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM1NWU2ZWFiZjg2NDYzNWI0NTIxNDRkY2I5MWQ1NmExMzlkZDMxYjcwM2ExZDQ3ZDhjZDNiOWE3ODA2YjY4MjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.zCW3cIuhj_rO8OwpGgZ0EO-YkTNqje_2aW8FJgi3p_c)

1. **Access the Generator**
    Open your browser and navigate to `/crud-generator`. If your application uses a custom prefix (e.g., `admin`), adjust the URL accordingly.
2. **Fill Out the Form**

    - **Model Name (PascalCase)** (e.g., `Post`)
    - **Table Name (snake\_case, plural)** (e.g., `posts`—auto-filled from Model Name)
    - **Generate Migration** (checkbox)
    - **Generate Seeder** (checkbox)
    - **Fields**

        - **Field Name** (snake\_case, no spaces)
        - **Type** (string, text, integer, boolean, date, datetime, email, password)
        - **Validation Rules** (Laravel validation syntax, e.g., `required|string|max:255`)
        - **Nullable** (checkbox)
    - **Quick Templates**

        - Click a template button (e.g., "Blog Post", "Product", "User") to load predefined fields.
3. **Generate CRUD**
    Click the "Generate CRUD" button. The package will scaffold files and append routes. A "Results" panel will list every created/modified file and next steps (e.g., run `php artisan migrate`).

### CLI/Artisan Command

[](#cliartisan-command)

The package provides an Artisan command to generate CRUD operations directly from the command line:

#### Basic Usage

[](#basic-usage)

```
php artisan crud:generate Book
```

#### Available Options

[](#available-options)

- `{model}` - The name of the model (required)
- `--table=` - The name of the table (optional, defaults to plural of model name)
- `--fields=` - Fields in JSON format (optional)
- `--no-migration` - Skip migration generation
- `--with-seeder` - Generate seeder

#### Examples

[](#examples)

**1. Interactive Mode (Recommended for beginners)**

```
php artisan crud:generate Post
```

This will prompt you to enter fields interactively.

**2. With JSON Fields**

```
php artisan crud:generate Book --fields='[
    {
        "name": "title",
        "type": "string",
        "validation": "required|string|max:255",
        "nullable": false
    },
    {
        "name": "author",
        "type": "string",
        "validation": "required|string|max:255",
        "nullable": false
    },
    {
        "name": "published_date",
        "type": "date",
        "validation": "nullable|date",
        "nullable": true
    },
    {
        "name": "summary",
        "type": "text",
        "validation": "nullable|string",
        "nullable": true
    },
    {
        "name": "is_best_seller",
        "type": "boolean",
        "validation": "boolean",
        "nullable": false
    }
]'
```

**3. Custom Table Name**

```
php artisan crud:generate Product --table=products_catalog
```

**4. Skip Migration**

```
php artisan crud:generate Category --no-migration
```

**5. With Seeder**

```
php artisan crud:generate User --with-seeder
```

#### Programmatic Usage

[](#programmatic-usage)

You can also call the `CrudGeneratorService` directly from within your own Artisan commands or controllers:

```
use SajidUlIslam\CrudGenerator\Services\CrudGeneratorService;

$data = [
    'model_name'     => 'Book',
    'table_name'     => 'books',
    'with_migration' => true,
    'with_seeder'    => false,
    'fields' => [
        [
            'name'       => 'title',
            'type'       => 'string',
            'validation' => 'required|string|max:255',
            'nullable'   => false,
        ],
        // ... more fields
    ],
];

$service = app(CrudGeneratorService::class);
$generated = $service->generateCrud($data);

// $generated is an array of created file paths and the appended route
```

---

Troubleshooting
---------------

[](#troubleshooting)

- **Directory Permissions**
    Ensure `app/Models/`, `database/migrations/`, `app/Http/Controllers/`, `app/Http/Requests/`, and `resources/views/` are writable (`chmod -R 755 `).
- **Route Duplication**
    If you regenerate CRUD for the same resource, you may see duplicate `Route::resource(...)` entries. Manually remove the extra line in `routes/web.php`.
- **UI FieldTypes Not Loading**
    If the UI's `` elements show empty, verify that your view is receiving a `$fieldTypes` array. In a controller method serving the UI, you should pass something like:

    ```
    $fieldTypes = [
        'string'   => 'String',
        'text'     => 'Text',
        'integer'  => 'Integer',
        'boolean'  => 'Boolean',
        'date'     => 'Date',
        'datetime' => 'DateTime',
        'email'    => 'Email',
        'password' => 'Password',
    ];

    return view('vendor.crud-generator.index', compact('fieldTypes'));
    ```

---

Contributing
------------

[](#contributing)

1. **Fork the Repo**
    Clone your fork:

    ```
    git clone https://github.com/your-username/laravel-crud-generator.git
    cd laravel-crud-generator
    ```
2. **Create a New Branch**

    ```
    git checkout -b feature/my-feature
    ```
3. **Make Changes &amp; Commit**
    Use clear, concise commit messages.
4. **Push &amp; Open a PR**

    ```
    git push origin feature/my-feature
    ```

    Open a pull request against the `main` branch. Include usage examples or tests if you introduce new functionality.

---

License
-------

[](#license)

This package is released under the [MIT License](LICENSE). Use, modify, and distribute freely.

---

Version
-------

[](#version)

1.0.1

Repo activity
-------------

[](#repo-activity)

[![Alt](https://camo.githubusercontent.com/2af4bb351d3205443f0c86f6ee7c6022eb12a7364b1a142db30b8454ed562ab3/68747470733a2f2f7265706f62656174732e6178696f6d2e636f2f6170692f656d6265642f643535386237376261366630666264623339623037366235643661333233653035373138656439332e737667 "Repobeats analytics image")](https://camo.githubusercontent.com/2af4bb351d3205443f0c86f6ee7c6022eb12a7364b1a142db30b8454ed562ab3/68747470733a2f2f7265706f62656174732e6178696f6d2e636f2f6170692f656d6265642f643535386237376261366630666264623339623037366235643661333233653035373138656439332e737667)

Acknowledgments
---------------

[](#acknowledgments)

- Inspired by Laravel's scaffolders and community-driven CRUD generators.
- UI built with [Bootstrap 5](https://getbootstrap.com/) and [Font Awesome](https://fontawesome.com/).
- Thanks to the Laravel community for ongoing inspiration and best practices.

Happy coding! 🚀

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance70

Regular maintenance activity

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

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

Total

3

Last Release

79d ago

Major Versions

1.0.1 → v2.x-dev2026-02-22

PHP version history (2 changes)v1.0.0PHP ^8.0

1.0.1PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f71e36c7f5c32dc973949325f4a8b3ed883e98bb4950b765c4626577df337461?d=identicon)[sajidulislam](/maintainers/sajidulislam)

---

Top Contributors

[![Sajid-al-islam](https://avatars.githubusercontent.com/u/72538066?v=4)](https://github.com/Sajid-al-islam "Sajid-al-islam (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sajidul-islam-laravel-crud-generator/health.svg)

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

9.4k1.8k](/packages/unopim-unopim)[64robots/checkout

Checkout Package.

382.9k](/packages/64robots-checkout)

PHPackages © 2026

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