muhammadsami/laravel-crud-generator

Laravel CRUD Generator using Repository Pattern by Muhammad Sami

Installs: 15

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/muhammadsami/laravel-crud-generator

dev-main 2025-09-23 12:24 UTC

This package is auto-updated.

Last update: 2025-12-23 13:10:51 UTC


README

Packagist Version License Stars

Generate Laravel CRUD boilerplate using the Repository Pattern — in seconds.
Built with by Muhammad Sami

Uploading image.png…

✨ Features

  • 🔧 Generates: Model, Migration, Form Request, Controller
  • 💡 Repository & Interface Pattern
  • ⚙️ Artisan Command Based
  • 🧱 PSR-4 Autoloaded Structure
  • ✏️ Stubs Fully Customizable
  • 🧼 Clean, Scalable & Maintainable Code

📦 Installation

Install via Composer:

composer require muhammadsami/laravel-crud-generator


2. Publish stub files:

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


⚡ Usage
Run the command to scaffold a full CRUD:


php artisan make:crud Product

This will generate:

app/Models/Product.php

app/Http/Requests/ProductRequest.php

app/Interfaces/ProductInterface.php

app/Repositories/ProductRepository.php

app/Http/Controllers/Api/ProductController.php

database/migrations/xxxx_xx_xx_xxxxxx_create_products_table.php

🛠 Configuration Steps

1. Bind Interface to Repository
Update AppServiceProvider:


public function register()
{
    $this->app->bind(
        \App\Interfaces\ProductInterface::class,
        \App\Repositories\ProductRepository::class
    );
}
3. Define Routes
In routes/api.php:

//Example
use App\Http\Controllers\Api\ProductController;

Route::apiResource('products', ProductController::class);

4. Customize Migration
You can modify the generated migration file before running:

php artisan migrate