muhammadsami/laravel-crud-generator

Laravel CRUD Generator using Repository Pattern by Muhammad Sami

v1.0.0 2025-06-28 15:06 UTC

This package is auto-updated.

Last update: 2025-06-28 15:57:34 UTC


README

Packagist Version License Stars

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

image

โœจ 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



โšก 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
    );
}
2. Define Routes
In routes/api.php:


use App\Http\Controllers\Api\ProductController;

Route::apiResource('products', ProductController::class);
3. Customize Migration
You can modify the generated migration file before running:

php artisan migrate