shehroz / crud-generator
Laravel CRUD Generator with roles, permissions, policies, and API support
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/shehroz/crud-generator
Requires
- php: ^8.1|^8.2|^8.3
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
This package is auto-updated.
Last update: 2025-12-28 07:32:36 UTC
README
A powerful Laravel package to generate complete CRUD operations with roles, permissions, policies, and optional API support. Compatible with Laravel 9, 10, and 11.
Features
- Generates controllers, models, requests, repositories, interfaces, policies, migrations, seeders, and views.
- Supports nested paths (e.g.,
admin/location). - Optional API CRUD generation with
--apior--bothflags. - Modern Tailwind-based Blade templates for web interfaces.
- Role-based permissions using Laravel's authorization system.
- Compatible with PHP 8.1+ and Laravel 9, 10, and 11.
Installation
Install the package via Composer:
composer require shehroz/crud-generator
Publish the stubs (optional, to customize templates):
php artisan vendor:publish --tag=crud-generator-stubs
Usage
Run the make:crud command to generate CRUD components:
php artisan make:crud ModelName
Options
--api: Generates only API CRUD (API controller and routes).--both: Generates both web and API CRUDs.
Examples
Generate a CRUD for Location in the admin namespace:
php artisan make:crud admin/location
Generate an API-only CRUD for Product:
php artisan make:crud Product --api
Generate both web and API CRUDs for Category:
php artisan make:crud Category --both
Generated Files
- Controller:
App\Http\Controllers\[Namespace]\ModelNameController.php - API Controller:
App\Http\Controllers\Api\[Namespace]\ModelNameController.php(with--apior--both) - Model:
App\Models\[Namespace]\ModelName.php - Request:
App\Http\Requests\[Namespace]\ModelNameRequest.php - Repository:
App\Repositories\[Namespace]\ModelNameRepository.php - Interface:
App\Repositories\Interfaces\[Namespace]\ModelNameRepositoryInterface.php - Policy:
App\Policies\[Namespace]\ModelNamePolicy.php - Migration:
database/migrations/YYYY_MM_DD_HHMMSS_create_model_table.php - Seeder:
database/seeders/ModelNameSeeder.php - Views:
resources/views/[namespace]/modelname/*.blade.php(for web CRUD)
Requirements
- PHP: ^8.1|^8.2|^8.3
- Laravel: ^9.0|^10.0|^11.0
License
This package is open-sourced under the MIT license.
Author
Muhammad Shehroz - LinkedIn