PHPackages                             tufikhasan/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. [Admin Panels](/categories/admin)
4. /
5. tufikhasan/laravel-crud-generator

ActiveLibrary[Admin Panels](/categories/admin)

tufikhasan/laravel-crud-generator
=================================

Enterprise-grade CRUD generator for Laravel supporting both hybrid (DTO/Action) and simple architecture patterns.

v1.1.1(today)012↑2650%MITPHPPHP ^8.2

Since Aug 1Pushed todayCompare

[ Source](https://github.com/tufikhasan/laravel-crud-generator)[ Packagist](https://packagist.org/packages/tufikhasan/laravel-crud-generator)[ RSS](/packages/tufikhasan-laravel-crud-generator/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

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

[](#laravel-enterprise-crud-generator)

[![Laravel](https://camo.githubusercontent.com/37f3d5a5a787401d3dbec5a32a7de6a6e973ea266309e69a97e184d1ef4ef57f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3131253230253743253230313225323025374325323031332d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://laravel.com)[![PHP](https://camo.githubusercontent.com/55239fed202a8d0166ef8d9fcc163425f68eb6123d9b0edf0579051291553f6e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322b2d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://php.net)[![License](https://camo.githubusercontent.com/422db9fd40f5831c765cf6530b6750c081b696bd18d904cf89554df98c676277/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e3f7374796c653d666c61742d737175617265)](LICENSE)

> Generate **production-ready, enterprise-grade CRUD scaffolding** in seconds — following the **DTO → Action → Service → Controller** architecture.

One command. Thirteen files. Zero boilerplate.

```
php artisan make:crud Category --api
```

```
 INFO  Generating enterprise CRUD for [Category]...

 ✓ DTO
 ✓ Store Action
 ✓ Update Action
 ✓ Delete Action
 ✓ Service
 ✓ Store Request
 ✓ Update Request
 ✓ Admin Controller
 ✓ API Resource
 ✓ API Controller
 ✓ Blade Views (index, create, edit, form)
 ✓ Routes appended

  INFO  CRUD for [Category] generated successfully!

  API routes:  /api/categories
  Admin routes: /admin/categories
  Route names:  admin.categories.{index|create|store|edit|update|destroy}

  Next steps:
  1. Update your migration in database/migrations/
  2. Fill in the $fillable array on the Category model
  3. Add fields to the DTO and Service
  4. Update validation rules in app/Http/Requests/Category
  5. Map fields in the toArray() method of app/Http/Resources/Category/CategoryResource.php

```

---

Features
--------

[](#features)

- ✅ Follows **SOLID principles** — Actions, Services, DTOs, Policies
- ✅ **Config-aware** paths — customize all output directories
- ✅ **Publishable stubs** — override any generated file template
- ✅ **Model + migration by default** — pass `--skip-model` if already exists
- ✅ Optional `--api` flag — API controller + Resource + routes
- ✅ Optional `--simple` (`-s`) flag — Bypass DTOs &amp; Actions for simple CRUD
- ✅ `--force` flag to overwrite existing files
- ✅ **Individual commands** — generate only what you need
- ✅ Auto-registers via **Laravel package auto-discovery**
- ✅ Works with **Laravel 11, 12, and 13**

---

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

[](#requirements)

RequirementVersionPHP`^8.2`Laravel`^11---

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

[](#installation)

### Composer (Packagist)

[](#composer-packagist)

```
composer require tufikhasan/laravel-crud-generator
```

The package registers itself automatically via Laravel's package auto-discovery.

---

Quick Start
-----------

[](#quick-start)

### Generate a full CRUD module

[](#generate-a-full-crud-module)

```
# Admin CRUD only (views + routes + model + migration)
php artisan make:crud Product

# Admin + API (controller, resource, routes)
php artisan make:crud Product --api

# Skip model/migration if the model already exists
php artisan make:crud Product --skip-model

# Generate simple CRUD (Request -> Controller -> Service -> Model)
php artisan make:crud Category --simple

# Overwrite existing files
php artisan make:crud Product --force
```

---

Commands Reference
------------------

[](#commands-reference)

### `make:crud` — Full Scaffolding

[](#makecrud--full-scaffolding)

```
php artisan make:crud {name} [--api] [--skip-model] [--force]
```

Argument/OptionDescription`name`Model name in StudlyCase (`Category`, `ProductVariant`)`--api`Also generate API controller, API resource, and API routes`--S, --simple`Generate simple CRUD (Request -&gt; Controller -&gt; Service)`--skip-model`Skip model + migration (use when the model already exists)`--force`Overwrite existing files**Generated files (with `--api`):**

FilePathModel`app/Models/Category.php`Migration`database/migrations/xxxx_create_categories_table.php`DTO`app/DTOs/Category/CategoryData.php`Store Action`app/Actions/Category/StoreCategoryAction.php`Update Action`app/Actions/Category/UpdateCategoryAction.php`Delete Action`app/Actions/Category/DeleteCategoryAction.php`Service`app/Services/Category/CategoryService.php`Store Request`app/Http/Requests/Category/StoreCategoryRequest.php`Update Request`app/Http/Requests/Category/UpdateCategoryRequest.php`Admin Controller`app/Http/Controllers/Admin/CategoryController.php`API Resource`app/Http/Resources/Category/CategoryResource.php`API Controller`app/Http/Controllers/Api/CategoryController.php`Index View`resources/views/pages/admin/categories/index.blade.php`Create View`resources/views/pages/admin/categories/create.blade.php`Edit View`resources/views/pages/admin/categories/edit.blade.php`Form View`resources/views/pages/admin/categories/form.blade.php`Show View`resources/views/pages/admin/categories/show.blade.php`RoutesAppended to `routes/web.php` (and `routes/api.php` if `--api`)---

### Individual Commands

[](#individual-commands)

Use these when you need to generate only a single piece.

#### `make:dto`

[](#makedto)

```
php artisan make:dto Category
```

Generates: `app/DTOs/Category/CategoryData.php`

---

#### `make:action`

[](#makeaction)

```
php artisan make:action Category store    # StoreCategoryAction.php
php artisan make:action Category update   # UpdateCategoryAction.php
php artisan make:action Category delete   # DeleteCategoryAction.php
```

---

#### `make:crud-service`

[](#makecrud-service)

```
php artisan make:crud-service Category
```

Generates: `app/Services/Category/CategoryService.php`

---

#### `make:crud-request`

[](#makecrud-request)

```
php artisan make:crud-request Category store    # StoreCategoryRequest.php
php artisan make:crud-request Category update   # UpdateCategoryRequest.php
```

---

#### `make:crud-controller`

[](#makecrud-controller)

```
php artisan make:crud-controller Category admin   # Admin/CategoryController.php
php artisan make:crud-controller Category api     # Api/CategoryController.php
```

---

#### `make:crud-resource`

[](#makecrud-resource)

```
php artisan make:crud-resource Category
```

Generates: `app/Http/Resources/Category/CategoryResource.php`

---

#### `make:crud-views`

[](#makecrud-views)

```
php artisan make:crud-views Category
```

Generates: `resources/views/pages/admin/categories/{index,create,edit,form}.blade.php`

---

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

[](#configuration)

Publish the config file to customize all defaults:

```
php artisan vendor:publish --tag=crud-generator-config
```

This creates `config/crud-generator.php`:

```
return [

    // Auto-detected from composer.json. Set to override.
    'namespace' => env('CRUD_NAMESPACE', ''),

    // Output paths, relative to app_path()
    'paths' => [
        'dto'              => 'DTOs',
        'action'           => 'Actions',
        'service'          => 'Services',
        'request'          => 'Http/Requests',
        'controller_admin' => 'Http/Controllers/Admin',
        'controller_api'   => 'Http/Controllers/Api',
        'resource'         => 'Http/Resources',
    ],

    // Blade view output path, relative to resource_path('views')
    'view_path' => 'pages/admin',

    // Route generation settings
    'routes' => [
        'web_prefix'  => env('CRUD_ROUTE_WEB_PREFIX', 'admin'),
        'name_prefix' => env('CRUD_ROUTE_NAME_PREFIX', 'admin'),
        'api_prefix'  => env('CRUD_ROUTE_API_PREFIX', ''),
    ],

];
```

### Configuration Reference

[](#configuration-reference)

KeyDefaultDescription`namespace``''` (auto)App root namespace. Auto-detected if empty.`paths.dto``DTOs`DTO directory relative to `app/``paths.action``Actions`Action directory`paths.service``Services`Service directory`paths.request``Http/Requests`Form Request directory`paths.controller_admin``Http/Controllers/Admin`Admin controller directory`paths.controller_api``Http/Controllers/Api`API controller directory`paths.resource``Http/Resources`API Resource directory`view_path``pages/admin`Relative to `resources/views/``routes.web_prefix``admin`URL prefix for admin routes`routes.name_prefix``admin`Named route prefix`routes.api_prefix``''`URL prefix for API routes---

Customizing Stubs
-----------------

[](#customizing-stubs)

### 1. Publish Stubs

[](#1-publish-stubs)

```
# Publish stubs only
php artisan vendor:publish --tag=crud-generator-stubs

# Publish everything (config + stubs)
php artisan vendor:publish --tag=crud-generator
```

Stubs are copied to `stubs/crud/` in your project root:

```
stubs/crud/
├── dto.stub
├── action.store.stub
├── action.update.stub
├── action.delete.stub
├── service.stub
├── request.store.stub
├── request.update.stub
├── controller.admin.stub
├── controller.api.stub
├── resource.stub
└── views/
    ├── index.blade.stub
    ├── create.blade.stub
    ├── edit.blade.stub
    ├── form.blade.stub
    └── show.blade.stub

```

### 2. Edit a Stub

[](#2-edit-a-stub)

The generator **always checks your published stubs first**, then falls back to the package defaults.

Example — add a `Policy` check to the generated Store Request:

```
// stubs/crud/request.store.stub

public function authorize(): bool
{
    return $this->user()->can('create', {{ ModelName }}::class);
}
```

### 3. Available Stub Tokens

[](#3-available-stub-tokens)

Every stub supports these replacement tokens:

TokenCategory →`{{ ModelName }}``Category``{{ modelName }}``category``{{ model_name }}``category``{{ model-name }}``category``{{ ModelNames }}``Categories``{{ modelNames }}``categories``{{ model_names }}``categories``{{ model-names }}``categories``{{ RootNamespace }}``App``{{ RouteNamePrefix }}``admin` *(from config)*`{{ RouteWebPrefix }}``admin` *(from config)*---

Architecture Overview
---------------------

[](#architecture-overview)

This package supports two enterprise-grade architectural patterns. A hybrid approach is recommended for most applications.

### 1. Hybrid Architecture (Default)

[](#1-hybrid-architecture-default)

The best choice for complex entities (e.g., enterprise multi-vendor eCommerce, SaaS subscriptions, POS, inventory, accounting).

```
HTTP Request
     │
     ▼
Controller  (HTTP only — validate, authorize, build DTO, call Action)
     │
     ▼
Form Request (validation + authorization)
     │
     ▼
DTO  (readonly value object — carries validated data)
     │
     ▼
Action  (one use-case — wraps service in DB::transaction)
     │
     ▼
Service  (reusable business logic — create / update / delete)
     │
     ▼
Model  (Eloquent)

```

### 2. Simple Architecture (`--simple` or `-s`)

[](#2-simple-architecture---simple-or--s)

Excellent for basic entities like `Category`, `Brand`, `Unit`, `Country`, `City`, or `Color`. It skips the DTO and Action layers entirely.

```
HTTP Request
     │
     ▼
Controller  (HTTP only — validate, authorize, pass data to Service)
     │
     ▼
Form Request (validation + authorization)
     │
     ▼
Service  (reusable business logic — create / update / delete)
     │
     ▼
Model  (Eloquent)

```

### Example generated DTO

[](#example-generated-dto)

```
class CategoryData
{
    public function __construct(
        public readonly string $name,
        public readonly bool $status,
    ) {}

    public static function fromRequest(StoreCategoryRequest|UpdateCategoryRequest $request): self
    {
        return new self(
            name:   $request->string('name')->toString(),
            status: $request->boolean('status'),
        );
    }
}
```

### Example generated Action

[](#example-generated-action)

```
class StoreCategoryAction
{
    public function __construct(
        private readonly CategoryService $service,
    ) {}

    public function execute(CategoryData $data): Category
    {
        return DB::transaction(
            fn () => $this->service->create($data)
        );
    }
}
```

---

Users install with:

```
composer require tufikhasan/laravel-crud-generator
```

---

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

[](#contributing)

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/my-feature`
3. Commit your changes
4. Push and open a Pull Request

---

License
-------

[](#license)

MIT © [Towfik Hasan](https://github.com/tufikhasan)

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance100

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Total

3

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/15fe82f9d666fd89c409a557449435f5b3881c18d84a6ec772037a1172f812eb?d=identicon)[tufikhasan](/maintainers/tufikhasan)

---

Top Contributors

[![tufikhasan](https://avatars.githubusercontent.com/u/52672268?v=4)](https://github.com/tufikhasan "tufikhasan (8 commits)")

---

Tags

laravelscaffoldinggeneratorartisanservicecruddtoaction

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel/sail

Docker files for running a basic Laravel application.

1.9k212.4M1.4k](/packages/laravel-sail)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M275](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

78727.1M205](/packages/laravel-mcp)[propaganistas/laravel-disposable-email

Disposable email validator

6023.2M7](/packages/propaganistas-laravel-disposable-email)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

5031.3k](/packages/erag-laravel-lang-sync-inertia)

PHPackages © 2026

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