sndpbag/crud-generator

A powerful Laravel CRUD generator package with advanced features

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/sndpbag/crud-generator

1.0.0 2025-11-22 02:57 UTC

This package is auto-updated.

Last update: 2025-12-22 03:20:13 UTC


README

"# CRUD Generator"

🚀 Laravel CRUD Generator

Latest Version Total Downloads License Stars

Generate complete Laravel CRUD in seconds with a single command!

Features â€ĸ Installation â€ĸ Quick Start â€ĸ Documentation â€ĸ Contributing

đŸŽ¯ Why This Package?

Stop wasting time writing repetitive CRUD code! This package generates:

  • ✅ Model with relationships
  • ✅ Migration with all field types
  • ✅ Controller with complete CRUD logic
  • ✅ Form Request validation classes
  • ✅ Beautiful responsive views (Bootstrap/Tailwind)
  • ✅ Automatic route registration
  • ✅ Feature tests
  • ✅ And much more...

All in just 5 seconds! ⚡

✨ Features

🎨 Smart Generation

  • 26 Advanced Features
  • Smart field type detection
  • Enum fields with dropdowns
  • File & image uploads
  • Relationship scaffolding

🔧 Developer Friendly

  • Customizable stubs
  • Bootstrap & Tailwind support
  • API mode (JSON responses)
  • Authentication support
  • ✅ Email Notification (Mailable + Job) support

đŸ§Ē Testing Ready

  • PHPUnit test generation
  • Pest test support
  • Complete test coverage
  • TDD workflow

đŸ“Ļ Production Ready

  • Namespaced generation
  • Soft deletes
  • Search & sorting
  • Pagination

đŸ“Ļ Installation

composer require sndpbag/crud-generator

That's it! No configuration needed. Start generating CRUDs immediately.

🚀 Quick Start

Basic Example

php artisan make:crud Product --fields="name:string,price:integer,description:text"

Generated files in 5 seconds:

  • ✅ app/Models/Product.php
  • ✅ database/migrations/..._create_products_table.php
  • ✅ app/Http/Controllers/ProductController.php
  • ✅ app/Http/Requests/StoreProductRequest.php
  • ✅ app/Http/Requests/UpdateProductRequest.php
  • ✅ resources/views/products/*.blade.php
  • ✅ Routes in routes/web.php

Run migration and you're done:

php artisan migrate

Visit: http://localhost/products 🎉

💡 Advanced Usage

E-commerce Product CRUD

php artisan make:crud Product \
  --fields="name:string:unique,slug:string:unique,price:decimal:default(0),stock:integer,image:image:nullable,status:enum(active,inactive):default('active'),is_featured:boolean:default(0)" \
  --belongsTo=Category \
  --belongsTo=Brand \
  --softdelete \
  --auth \
  --tests

Admin Panel

php artisan make:crud Admin/Post \
  --fields="title:string:unique,content:text,featured_image:image:nullable" \
  --belongsTo=User \
  --belongsTo=Category \
  --auth

API Endpoints

php artisan make:crud Product --fields="name:string,price:integer" --api

📧 āχāĻŽā§‡āϞ āύ⧋āϟāĻŋāĻĢāĻŋāϕ⧇āĻļāύ āϏāĻš CRUD

āφāĻĒāύāĻŋ āϝāĻĻāĻŋ āϚāĻžāύ āϝ⧇ āύāϤ⧁āύ āϕ⧋āύ⧋ āĻĄā§‡āϟāĻž āϤ⧈āϰāĻŋ (create) āĻšāĻ“ā§ŸāĻžāϰ āϏāĻžāĻĨ⧇ āϏāĻžāĻĨ⧇ āĻāĻ•āϟāĻŋ āχāĻŽā§‡āϞ āύ⧋āϟāĻŋāĻĢāĻŋāϕ⧇āĻļāύ āĻĒāĻžāĻ āĻžāύ⧋ āĻšā§‹āĻ•, āϤāĻŦ⧇ --email āĻĢā§āĻ˛ā§āϝāĻžāĻ—āϟāĻŋ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰ⧁āύāĨ¤

php artisan make:crud Order --fields="item_name:string,price:integer" --belongsTo=User --email


āĻāϟāĻŋ āĻ¸ā§āĻŦ⧟āĻ‚āĻ•ā§āϰāĻŋ⧟āĻ­āĻžāĻŦ⧇ āϤ⧈āϰāĻŋ āĻ•āϰāĻŦ⧇:

✅ app/Mail/OrderCreatedMailable.php (ShouldQueue āϏāĻš)

✅ app/Jobs/SendOrderCreatedEmailJob.php

✅ resources/views/emails/order.blade.php (Markdown āĻŸā§‡āĻŽāĻĒā§āϞ⧇āϟ)

✅ OrderController-āĻāϰ store āĻŽā§‡āĻĨāĻĄā§‡ āϜāĻŦ āĻĄāĻŋāϏāĻĒā§āϝāĻžāϚ āĻ•āϰāĻžāϰ āϕ⧋āĻĄāĨ¤


---

## 🎨 Field Types

| Type | HTML | Example |
|------|------|---------|
| string | `<input type="text">` | `name:string` |
| text | `<textarea>` | `description:text` |
| integer | `<input type="number">` | `age:integer` |
| decimal | `<input type="number">` | `price:decimal` |
| boolean | `<input type="checkbox">` | `is_active:boolean` |
| date | `<input type="date">` | `birth_date:date` |
| datetime | `<input type="datetime-local">` | `published_at:datetime` |
| email | `<input type="email">` | `email:email` |
| file | `<input type="file">` | `document:file` |
| image | `<input type="file" accept="image/*">` | `photo:image` |
| enum | `<select>` | `status:enum(active,inactive)` |

---

## 🔧 Modifiers

```bash
# Nullable field
--fields="description:text:nullable"

# Unique constraint
--fields="email:email:unique"

# Default value
--fields="status:enum(active,inactive):default('active')"

# Combine modifiers
--fields="slug:string:unique:nullable"

🔗 Relationships

# BelongsTo (generates dropdown in forms)
--belongsTo=User --belongsTo=Category

# HasMany
--hasMany=Comment --hasMany=Review

đŸŽ¯ Command Flags

Flag Description Example
--fields Define fields --fields="name:string,price:integer"
--belongsTo Add belongsTo relationship --belongsTo=User
--hasMany Add hasMany relationship --hasMany=Comment
--softdelete Enable soft deletes --softdelete
--auth Add auth middleware --auth
--api Generate API instead of web --api
--tests Generate PHPUnit tests --tests
--pest Generate Pest tests --pest
--email āύāϤ⧁āύ āϰ⧇āĻ•āĻ°ā§āĻĄ āϤ⧈āϰāĻŋ āĻšāϞ⧇ āχāĻŽā§‡āϞ āĻĒāĻžāĻ āĻžāύ⧋āϰ āϜāĻ¨ā§āϝ Mailable āĻ“ Job āϤ⧈āϰāĻŋ āĻ•āϰ⧇ --email

đŸ—‘ī¸ Rollback

Delete all generated files:

php artisan crud:delete Product

📚 Documentation

đŸŽĨ Video Tutorial

Coming soon! Subscribe to our YouTube channel.

📊 Comparison

Feature Manual Coding This Package
Time Required ~2 hours 5 seconds
Model ✋ Manual ✅ Auto
Migration ✋ Manual ✅ Auto
Controller ✋ Manual ✅ Auto
Validation ✋ Manual ✅ Auto
Views ✋ Manual ✅ Auto
Routes ✋ Manual ✅ Auto
Tests ✋ Manual ✅ Auto
File Uploads ✋ Manual ✅ Auto
Relationships ✋ Manual ✅ Auto

🌟 Real-World Examples

Blog System

php artisan make:crud Post --fields="title:string:unique,content:text,status:enum(draft,published)" --belongsTo=User --hasMany=Comment --softdelete --auth --tests

Inventory Management

php artisan make:crud Product --fields="sku:string:unique,name:string,stock:integer,price:decimal" --belongsTo=Category --belongsTo=Supplier --auth

Booking System

php artisan make:crud Appointment --fields="appointment_date:datetime,status:enum(pending,confirmed,cancelled)" --belongsTo=User --belongsTo=Service --auth

See more in EXAMPLES.md

âš™ī¸ Configuration

Publish config file:

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

Customize in config/crud-generator.php:

return [
    'template' => 'bootstrap', // or 'tailwind'
    'storage_path' => 'public/uploads',
    'pagination' => 10,
    'alert_library' => 'sweetalert2',
];

āφāĻĒāύāĻŋ `config/crud-generator.php` āĻĢāĻžāχāϞ⧇ āĻĄāĻŋāĻĢāĻ˛ā§āϟ āĻ­ā§āϝāĻžāϞ⧁ āĻĒāϰāĻŋāĻŦāĻ°ā§āϤāύ āĻ•āϰāϤ⧇ āĻĒāĻžāϰ⧇āύāĨ¤

āĻĒā§āϰāĻĨāĻŽā§‡ āĻ•āύāĻĢāĻŋāĻ— āĻĢāĻžāχāϞāϟāĻŋ āĻĒāĻžāĻŦāϞāĻŋāĻļ āĻ•āϰ⧁āύ:
```bash
php artisan vendor:publish --tag=crud-generator-config


📧 āχāĻŽā§‡āϞ āύ⧋āϟāĻŋāĻĢāĻŋāϕ⧇āĻļāύ āϏ⧇āϟāφāĻĒ (Email Notification Setup)
--email āĻĢā§āĻ˛ā§āϝāĻžāĻ—āϟāĻŋ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āφāĻĒāύāĻžāϕ⧇ āĻĻ⧁āϟāĻŋ āϜāĻŋāύāĻŋāϏ āϏ⧇āϟ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇:

ā§§. āĻ…ā§āϝāĻžāĻĄāĻŽāĻŋāύ āχāĻŽā§‡āϞ āϏ⧇āϟ āĻ•āϰ⧁āύ: JobGenerator āĻ¸ā§āĻŦ⧟āĻ‚āĻ•ā§āϰāĻŋ⧟āĻ­āĻžāĻŦ⧇ āĻŽāĻĄā§‡āϞ⧇ email āĻĢāĻŋāĻ˛ā§āĻĄ āϖ⧁āρāĻœā§‡ āĻŦ⧇āϰ āĻ•āϰāĻžāϰ āĻšā§‡āĻˇā§āϟāĻž āĻ•āϰ⧇āĨ¤ āϝāĻĻāĻŋ āύāĻž āĻĒāĻžā§Ÿ, āϤāĻŦ⧇ āĻāϟāĻŋ config/crud-generator.php āĻĢāĻžāχāϞ⧇ āĻĨāĻžāĻ•āĻž admin_email āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰ⧇āĨ¤

āφāĻĒāύāĻžāϰ .env āĻĢāĻžāχāϞ⧇ āĻ…ā§āϝāĻžāĻĄāĻŽāĻŋāύ āχāĻŽā§‡āϞ āϝ⧋āĻ— āĻ•āϰ⧁āύ:

ADMIN_EMAIL="your_admin_email@example.com"

⧍. Queue Worker āϚāĻžāϞ⧁ āĻ•āϰ⧁āύ: āχāĻŽā§‡āϞāϗ⧁āϞ⧋ āϝ⧇āύ āχāωāϜāĻžāϰ āĻāĻ•ā§āϏāĻĒ⧇āϰāĻŋā§Ÿā§‡āĻ¨ā§āϏ āύāĻˇā§āϟ āύāĻž āĻ•āϰ⧇, āϏ⧇āϜāĻ¨ā§āϝ āĻāϗ⧁āϞ⧋ Queue-āĻāϰ āĻŽāĻžāĻ§ā§āϝāĻŽā§‡ āĻĒāĻžāĻ āĻžāύ⧋ āĻšā§Ÿ (ShouldQueue)āĨ¤ āϤāĻžāχ āφāĻĒāύāĻžāϕ⧇ āĻ…āĻŦāĻļā§āϝāχ āĻāĻ•āϟāĻŋ Queue Worker āϚāĻžāϞ⧁ āϰāĻžāĻ–āϤ⧇ āĻšāĻŦ⧇:

php artisan queue:work

🎨 Customize Templates

Publish stubs:

php artisan vendor:publish --tag=crud-generator-stubs

Edit files in stubs/crud-generator/ to customize generated code.

đŸ§Ē Testing

Run package tests:

composer test

Generate tests for your CRUD:

php artisan make:crud Product --fields="name:string" --tests
php artisan test

🤝 Contributing

We love contributions! Please read our Contributing Guide.

Contributors

📝 Changelog

See CHANGELOG.md for all changes.

🐛 Issues

Found a bug? Open an issue

đŸ’Ŧ Discussions

Have questions? Start a discussion

⭐ Star History

Star History Chart

📄 License

The MIT License (MIT). See LICENSE for details.

💝 Support

If you find this package helpful, please consider:

  • ⭐ Starring the repository
  • 🐛 Reporting bugs
  • 💡 Suggesting features
  • 📖 Improving documentation
  • ☕ Buy me a coffee

🙏 Acknowledgments

  • Laravel Community
  • All Contributors
  • Open Source Community

Made with â¤ī¸ for the Laravel Community

Built by sandipan kr bag