Download the PHP package rahulp/crud-generator without Composer
On this page you can find all versions of the php package rahulp/crud-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rahulp/crud-generator
More information about rahulp/crud-generator
Files in rahulp/crud-generator
Package crud-generator
Short Description A Laravel package for generating CRUD operations with Repository Pattern
License MIT
Informations about the package crud-generator
Laravel CRUD Generator with Repository Pattern
A powerful Laravel package that generates complete CRUD operations with Repository Pattern implementation, along with API response helpers and database transaction middleware.
Features
- 🚀 Project setup with essential middleware and helpers
- 🏗️ Generates Models, Controllers, Services, and Repositories
- 📦 Automatic repository binding setup
- 🔄 Database transaction middleware
- 📬 API response helper functions
- ⚡ Support for Laravel 11
- 🛠️ Customizable validation rules
Installation
You can install the package via composer:
Commands
1. Project Setup (Required First)
This command sets up essential components needed for the CRUD operations:
A. Database Transaction Middleware
Automatically adds and registers middleware that:
- Wraps all API requests in database transactions
- Automatically commits on successful responses
- Rolls back on exceptions or error responses (4xx, 5xx)
- Handles exceptions gracefully
B. API Response Helpers
Adds global helper functions for consistent API responses:
- Success Response Helper:
Success Response Format:
- Error Response Helper:
Error Types and Status Codes:
validation(422) - Validation errorsunauthenticated(401) - Authentication requirednotfound(404) - Resource not foundforbidden(403) - Permission deniedprocessError(400) - Bad requestloginCase(306) - Login specific errors- Default (500) - Server errors
Error Response Format:
2. Generate CRUD Operations
After setting up the project, you can generate CRUD operations:
Parameters:
model: Name of the model (e.g., Post, User, Product)columns: Column definitions in format: name:type:required|nullable:default
Supported Column Types:
string- String/varchar fieldsinteger- Whole numbersdecimal- Decimal numbers (prices, measurements)text- Long text contentboolean- True/false valuesdate- Date onlydatetime- Date and timetimestamp- Timestamps
Examples:
-
Basic Post Model:
-
Product with Default Values:
- User Model with Validation:
Each make:crud command generates:
- Database migration
- Model with fillable fields and defaults
- Repository interface and implementation
- Service class for business logic
- API controller with validation
- Automatic repository binding
Generated Structure
For a Post model, it creates:
API Endpoints
Each CRUD generation creates these endpoints:
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.