PHPackages                             nodirjon/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. nodirjon/crud-generator

ActiveLibrary[Admin Panels](/categories/admin)

nodirjon/crud-generator
=======================

A Laravel CRUD generator that creates Controller, Service, Repository, DTO, and Request classes from a single Artisan command. Supports automatic file/media upload handling.

v1.0.0(1mo ago)02MITPHPPHP ^8.2

Since Jul 13Pushed 1mo agoCompare

[ Source](https://github.com/XamidovNodirjon/crud-generator)[ Packagist](https://packagist.org/packages/nodirjon/crud-generator)[ RSS](/packages/nodirjon-crud-generator/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

nodirjon/crud-generator
=======================

[](#nodirjoncrud-generator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6a93506920aa37213b30e9886ba39847c5666826ffec53057745848515db46c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f6469726a6f6e2f637275642d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nodirjon/crud-generator)[![Total Downloads](https://camo.githubusercontent.com/ea90c354b14fdba4bf22f743c32cdbc77e35cd21b2e57cb62cae34843d41124d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f6469726a6f6e2f637275642d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nodirjon/crud-generator)[![License](https://camo.githubusercontent.com/fe539ed68209e19f4103e6b97acc48e2ba4f4ed1c0c6a4bc57745c5d2aeedbb5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6f6469726a6f6e2f637275642d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A powerful Laravel CRUD generator that scaffolds a complete layered architecture from a single Artisan command — **Controller → Service → Repository → DTO → Requests** — with automatic image/video upload handling.

---

Features
--------

[](#features)

- ✅ Generates **Controller**, **Service**, **Repository**, **DTO**, **StoreRequest**, **UpdateRequest** in one command
- ✅ Reads model `$fillable` fields automatically and generates proper validation rules
- ✅ **Auto-detects file/media fields** (`image`, `photo`, `video`, `avatar`, `cover`, `thumbnail`, `file`, `media`, `attachment`, `banner`, `poster`) and:
    - Adds `nullable|file|mimes:...` validation rules
    - Stores files in `storage/app/public/{model}/{id}/` folder
    - **Deletes old files** on update (no storage pollution)
    - **Deletes all files and the folder** on delete
- ✅ Consistent method names across all layers (`getAll`, `findById`, `create`, `update`, `delete`)
- ✅ Supports Laravel 10, 11, and 12
- ✅ Auto-registered via Laravel Package Discovery (no manual config needed)

---

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

[](#requirements)

- PHP &gt;= 8.2
- Laravel &gt;= 10.x

---

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

[](#installation)

```
composer require nodirjon/crud-generator
```

The package is auto-discovered by Laravel — no need to add anything to `config/app.php`.

---

Usage
-----

[](#usage)

### 1. Create your Model and Migration

[](#1-create-your-model-and-migration)

```
php artisan make:model Post -m
```

Add your fields to the migration and run it:

```
php artisan migrate
```

Define `$fillable` in your model:

```
// app/Models/Post.php
protected $fillable = ['title', 'body', 'cover_image', 'video'];
```

### 2. Generate CRUD

[](#2-generate-crud)

```
php artisan make:crud Post
```

**Output:**

```
Created: app/Http/Controllers/PostController.php
Created: app/Http/Requests/Post/StorePostRequest.php
Created: app/Http/Requests/Post/UpdatePostRequest.php
Created: app/Services/PostService.php
Created: app/Repositories/PostRepository.php
Created: app/DTO/PostDTO.php
CRUD for Post generated successfully!
  File fields detected: cover_image, video
  Files will be stored in: storage/app/public/post/{id}/

```

### 3. Register the route

[](#3-register-the-route)

```
// routes/api.php
Route::apiResource('posts', PostController::class);
```

### 4. Link storage (first time only)

[](#4-link-storage-first-time-only)

```
php artisan storage:link
```

---

Generated File Structure
------------------------

[](#generated-file-structure)

```
app/
├── Http/
│   ├── Controllers/
│   │   └── PostController.php       # index, store, show, update, destroy
│   └── Requests/
│       └── Post/
│           ├── StorePostRequest.php  # validation rules (auto-generated)
│           └── UpdatePostRequest.php
├── Services/
│   └── PostService.php              # business logic + file handling
├── Repositories/
│   └── PostRepository.php           # database queries
└── DTO/
    └── PostDTO.php                  # data transfer object

```

---

File Upload Behavior
--------------------

[](#file-upload-behavior)

When a model has fields containing file-related keywords (`image`, `photo`, `video`, `avatar`, `cover`, `thumbnail`, `file`, `media`, `attachment`, `banner`, `poster`), the generator automatically:

ActionBehavior**Create**Uploads file → `storage/public/{model}/tmp/` → moves to `{model}/{id}/` after creation**Update**Deletes old file → uploads new file to `{model}/{id}/`**Delete**Deletes all files and removes the `{model}/{id}/` directory### Storage path example

[](#storage-path-example)

```
storage/app/public/
└── post/
    └── 42/
        ├── cover_image_xR3kL2.jpg
        └── video_pQ7mN9.mp4

```

Public URL:

```
/storage/post/42/cover_image_xR3kL2.jpg

```

---

Auto-detected File Field Keywords
---------------------------------

[](#auto-detected-file-field-keywords)

The command detects the following keywords (case-insensitive, anywhere in the field name):

`image` · `photo` · `video` · `avatar` · `cover` · `thumbnail` · `file` · `media` · `attachment` · `banner` · `poster`

Examples: `profile_photo`, `cover_image`, `intro_video`, `user_avatar` are all detected automatically.

---

Customization
-------------

[](#customization)

After generation, you can freely customize any generated file. The service's `$fileFields` and `$folder` properties can be modified:

```
// app/Services/PostService.php
protected string $folder = 'posts';           // change storage folder name
protected array $fileFields = ['cover_image']; // add/remove file fields
```

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE) for details.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

49d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd8770792e519b54bc848bc180ad2ce0c4584740dff0d4a08577290fef3f1ebe?d=identicon)[nodirjon10\_01](/maintainers/nodirjon10_01)

---

Tags

laravelgeneratorartisanservicecrudrepositorydtofile-upload

### Embed Badge

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

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

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.1k6.4M360](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

20433.5M1.9k](/packages/illuminate-queue)[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.

6036.2k](/packages/erag-laravel-lang-sync-inertia)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

80732.6M270](/packages/laravel-mcp)[laravel/folio

Page based routing for Laravel.

604716.1k38](/packages/laravel-folio)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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