PHPackages                             shreyasarker/lara-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. shreyasarker/lara-crud

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

shreyasarker/lara-crud
======================

A simple CRUD generator package.

v2.0.0(4mo ago)161MITPHPPHP ^8.2

Since Jul 21Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/shreyasarker/laravel-crud-generator-package)[ Packagist](https://packagist.org/packages/shreyasarker/lara-crud)[ RSS](/packages/shreyasarker-lara-crud/feed)WikiDiscussions main Synced 1mo ago

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

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

[](#laravel-crud-generator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fca17d9ce1da3abfa1ccfd049e99770a52833da36295924911d1166cbca76f48/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368726579617361726b65722f6c6172612d637275642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shreyasarker/lara-crud)[![Total Downloads](https://camo.githubusercontent.com/69d355376b3c0869e8394c7576007d52326a847ad63d300fa463da6a8b3fe5cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7368726579617361726b65722f6c6172612d637275642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shreyasarker/lara-crud)[![License](https://camo.githubusercontent.com/08fed553664ec88acf27818e568b0127d5f144b7bf54f2554bd051494eebe9d3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7368726579617361726b65722f6c6172612d637275642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shreyasarker/lara-crud)

Generate complete CRUD operations for your Laravel application with a single command. Build migrations, models, controllers, requests, views, and routes in seconds with an interactive wizard.

✨ Features
----------

[](#-features)

- 🎯 **Interactive Field Wizard** - Define fields with types, validation, and options through a guided CLI
- 🎨 **Multiple UI Stacks** - Choose between Bootstrap 5 or Tailwind CSS for generated views
- 🔄 **Web &amp; API Support** - Generate standard web controllers or API-only controllers
- 📝 **Smart Model Generation** - Auto-generated fillable, casts, and hidden properties
- ✅ **Form Request Validation** - Custom validation messages and attribute names
- 🎭 **Nullable Support** - Automatically detects and applies nullable to migrations and models
- 🔧 **Flexible Options** - Generate only what you need with `--only` and `--skip` options
- 🧪 **Dry Run Mode** - Preview what will be generated before creating files
- 💪 **Force Overwrite** - Update existing files with `--force` flag

📋 Requirements
--------------

[](#-requirements)

- PHP 8.2 or higher
- Laravel 10.x, 11.x, or 12.x

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require shreyasarker/lara-crud --dev
```

The package will automatically register itself.

🚀 Quick Start
-------------

[](#-quick-start)

Generate a complete CRUD with the interactive wizard:

```
php artisan make:crud Post --interactive
```

Follow the prompts to add fields:

```
Field name: title
Type: string
Nullable? No
Validation rules: required|string|max:255

Field name: content
Type: text
Nullable? Yes
Validation rules: nullable|string

Field name: is_published
Type: boolean
Nullable? No
Validation rules: required|boolean

Add another field? No

```

This generates:

- ✅ Migration (`xxxx_create_posts_table.php`)
- ✅ Model (`Post.php`) with fillable, casts, and hidden
- ✅ Form Request (`PostRequest.php`) with validation rules
- ✅ Controller (`PostController.php`) with all CRUD methods
- ✅ Views (index, create, edit, show) with Bootstrap/Tailwind
- ✅ Routes (automatically registered in `routes/lara-crud.php`)

📖 Usage
-------

[](#-usage)

### Basic Command

[](#basic-command)

```
php artisan make:crud {name} --interactive
```

### Options

[](#options)

OptionDescription`--interactive`**Required** - Use interactive wizard to define fields`--stack=`UI framework: `bootstrap` (default) or `tailwind``--api`Generate API controller (skips views)`--only=`Generate only specific parts (comma-separated)`--skip=`Skip specific parts (comma-separated)`--force`Overwrite existing files`--dry-run`Preview without creating files### Examples

[](#examples)

#### Generate API-only CRUD

[](#generate-api-only-crud)

```
php artisan make:crud Product --interactive --api
```

Generated: Migration, Model, Request, API Controller, Routes (no views)

#### Use Tailwind CSS

[](#use-tailwind-css)

```
php artisan make:crud Post --interactive --stack=tailwind
```

#### Generate Specific Parts

[](#generate-specific-parts)

```
# Only model and migration
php artisan make:crud Post --interactive --only=model,migration

# Skip views and routes
php artisan make:crud Post --interactive --skip=views,routes
```

#### Preview Before Generating

[](#preview-before-generating)

```
php artisan make:crud Post --interactive --dry-run
```

#### Force Overwrite Existing Files

[](#force-overwrite-existing-files)

```
php artisan make:crud Post --interactive --force
```

🎨 Field Types
-------------

[](#-field-types)

The interactive wizard supports these field types:

TypeHTML InputDatabase ColumnCast Type`string`textstring(255)-`text`textareatextstring`email`emailstring(255)-`password`passwordstring(255)- (hidden)`integer`numberintegerinteger`bigint`numberbigIntegerinteger`decimal`numberdecimal(8,2)decimal:2`boolean`checkboxbooleanboolean`date`datedatedate`datetime`datetime-localdateTimedatetime`select`selectstring(255)-`mediumtext`textareamediumTextstring`longtext`textarealongTextstring📝 Generated Files
-----------------

[](#-generated-files)

### Migration

[](#migration)

```
