PHPackages                             fariddomat/auto-crud - 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. fariddomat/auto-crud

ActiveLibrary[Framework](/categories/framework)

fariddomat/auto-crud
====================

Auto Crud For laravel applications

112PHP

Since Mar 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/fariddomat/auto-crud)[ Packagist](https://packagist.org/packages/fariddomat/auto-crud)[ RSS](/packages/fariddomat-auto-crud/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Auto-Crud
=========

[](#auto-crud)

Auto-Crud is a Laravel package that automates the generation of complete CRUD (Create, Read, Update, Delete) functionality for your models. It streamlines development by creating models, controllers, migrations, views, and routes with a single interactive command. The package supports customizable fields (e.g., strings, decimals, selects, booleans, files, images), optional API controllers, dashboard prefixes, soft deletes, and middleware, all with a colorful command-line experience.

Installation
============

[](#installation)

```
    composer require fariddomat/auto-crud:dev-main
```

Publish the Blade views for CRUD operations:

```
    php artisan vendor:publish --provider="Fariddomat\AutoCrud\AutoCrudServiceProvider" --tag="autocrud-views"
```

This copies the customizable Blade views (create, edit, index) to your resources/views/vendor/auto-crud directory.

---

Usage
-----

[](#usage)

### Create a CRUD Module

[](#create-a-crud-module)

Use the interactive make:auto-crud Artisan command to generate a CRUD module. The command prompts you for details step-by-step, with hints and colored output:

bash

`php artisan make:auto-crud`

#### Interactive Example

[](#interactive-example)

text

` Welcome to AutoCRUD Generator! Let's create your CRUD module step-by-step. What is the name of your model? (e.g., Post, User; must start with a capital letter): Product Let's define the fields for Product. Format: name:type:modifiers (e.g., title:string:nullable, user_id:select). Leave blank to finish. Enter a field (or press Enter to skip): name:string Enter a field (or press Enter to skip): price:decimal Enter a field (or press Enter to skip): category_id:select Enter a field (or press Enter to skip):  Generate an API controller instead of a web controller? (Default: No) [N/y]: y Enable soft deletes for Product? (Default: No) [N/y]: y Force overwrite existing files if they exist? (Default: No) [N/y]: n Enter middleware (comma-separated, e.g., auth,admin) or leave blank for none: auth Generating CRUD with the following settings:   Model: Product   Fields: name:string, price:decimal, category_id:select   Type: API   Dashboard: No   Soft Deletes: Yes   Force Overwrite: No   Middleware: auth Proceed with these settings? [Y/n]:  Generating Auto CRUD for Product...`

This generates:

- **Model**: Product with soft deletes and fillable fields (name, price, category\_id).
- **Controller**: ProductApiController with API methods (index, create, store, show, edit, update, destroy, restore).
- **Migration**: Table products with columns id, name, price, category\_id, deleted\_at, created\_at, updated\_at.
- **Routes**: API routes in routes/api.php with auth middleware.

#### Web Example with Dashboard

[](#web-example-with-dashboard)

text

` Welcome to AutoCRUD Generator! Let's create your CRUD module step-by-step. What is the name of your model? (e.g., Post, User; must start with a capital letter): Item Let's define the fields for Item. Format: name:type:modifiers (e.g., title:string:nullable, user_id:select). Leave blank to finish. Enter a field (or press Enter to skip): name:string Enter a field (or press Enter to skip): description:text Enter a field (or press Enter to skip): image:image Enter a field (or press Enter to skip):  Generate an API controller instead of a web controller? (Default: No) [N/y]: n Place the CRUD under a dashboard prefix? (Default: No) [N/y]: y Enable soft deletes for Item? (Default: No) [N/y]: n Force overwrite existing files if they exist? (Default: No) [N/y]: y Enter middleware (comma-separated, e.g., auth,admin) or leave blank for none: auth,admin Proceed with these settings? [Y/n]: `

This generates:

- **Model**: Item with fillable fields (name, description, image).
- **Controller**: ItemController in App\\Http\\Controllers\\Dashboard with web methods.
- **Migration**: Table items with columns id, name, description, image, created\_at, updated\_at.
- **Views**: resources/views/dashboard/items/create.blade.php, edit.blade.php, index.blade.php.
- **Routes**: Web routes in routes/web.php under dashboard prefix with auth and admin middleware.

---

### Fields

[](#fields)

Define fields interactively with the following supported types:

Field TypeDescriptionExample UsagestringSimple text inputname:stringdecimalDecimal number (e.g., prices)price:decimalintegerInteger numberquantity:integertextLonger text fielddescription:textselectDropdown with relational optionsuser\_id:selectbooleanCheckbox (true/false)is\_active:booleanfileSingle file upload (e.g., PDF)manual:fileimageSingle image uploadthumbnail:imageimagesMultiple image uploadsgallery:imagesModifiers like :nullable or :unique can be appended (e.g., name:string:nullable).

---

### Features

[](#features)

✔ **Interactive CLI**: Generate CRUD with a colorful, step-by-step command-line interface.
✔ **Automatic CRUD Generation**: Creates models, controllers, migrations, views, and routes in one go.
✔ **Customizable Fields**: Supports a variety of data types, including relations and file uploads.
✔ **API Support**: Generates RESTful API controllers with JSON responses (e.g., 404 for missing records).
✔ **Dashboard Support**: Prefixes routes with dashboard for admin panels.
✔ **Soft Deletes**: Optional soft delete functionality with restore support.
✔ **Middleware**: Apply custom middleware (e.g., auth, admin) to routes and controllers.
✔ **Blade Views**: Dynamic create, edit, and index views with form fields matching your model.
✔ **File &amp; Image Uploads**: Handles single/multiple uploads with ImageHelper or Laravel’s storage system.

---

### File &amp; Image Handling

[](#file--image-handling)

#### Single Image Upload

[](#single-image-upload)

For image fields, the controller uses ImageHelper (if available) or Laravel’s storage:

php

`if ($request->hasFile('thumbnail') && class_exists('App\Helpers\ImageHelper')) {    $validated['thumbnail'] = ImageHelper::storeImageInPublicDirectory($request->file('thumbnail'), 'uploads/items');} elseif ($request->hasFile('thumbnail')) {    $validated['thumbnail'] = $request->file('thumbnail')->store('uploads/items', 'public');}`

#### Multiple Image Uploads

[](#multiple-image-uploads)

For images fields, processes multiple files into a JSON-encoded array:

php

`if ($request->hasFile('gallery') && class_exists('App\Helpers\ImageHelper')) {    $validated['gallery'] = [];    foreach ($request->file('gallery') as $image) {        $validated['gallery'][] = ImageHelper::storeImageInPublicDirectory($image, 'uploads/items');    }    $validated['gallery'] = json_encode($validated['gallery']);} elseif ($request->hasFile('gallery')) {    $validated['gallery'] = json_encode(array_map(fn($file) => $file->store('uploads/items', 'public'), $request->file('gallery')));}`

#### File Upload

[](#file-upload)

For file fields, stores using Laravel’s storage:

php

`if ($request->hasFile('manual')) {    $validated['manual'] = $request->file('manual')->store('uploads/manuals', 'public');}`

---

### Configuration

[](#configuration)

- **Customize Views**: Edit the generated Blade files in resources/views/\[dashboard/\]model\_name/ or the published views in resources/views/vendor/auto-crud.
- **Adjust Controllers**: Modify the generated controllers in app/Http/Controllers/ or app/Http/Controllers/Dashboard/.
- **Tweak Migrations**: Update the migration files in database/migrations/ as needed.

---

### Contribution

[](#contribution)

Contributions are welcome! Submit issues, bug fixes, or pull requests via GitHub to help improve Auto-Crud.

---

### License

[](#license)

Auto-Crud is licensed under the [MIT License](LICENSE). See the LICENSE file for details.

---

### Changes Made

[](#changes-made)

1. **Interactive CLI**: Updated the usage section to reflect the new interactive make:auto-crud command with colored output.
2. **Feature Enhancements**: Added soft deletes, middleware, and JSON error handling for API controllers.
3. **Field Updates**: Included integer in the field table and clarified modifier support.
4. **Examples**: Rewritten to show the interactive flow instead of static commands.
5. **Consistency**: Ensured terminology and examples match the latest package state (e.g., ApiController suffix for API).

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/67d09c13658910630a603e0e8e6937e392d6ab5ee8f6d5450a2b4d1b56768a03?d=identicon)[fariddomat](/maintainers/fariddomat)

---

Top Contributors

[![farid-domat](https://avatars.githubusercontent.com/u/239963924?v=4)](https://github.com/farid-domat "farid-domat (35 commits)")

### Embed Badge

![Health badge](/badges/fariddomat-auto-crud/health.svg)

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M190](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M255](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M591](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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