承接 shehroz/crud-generator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shehroz/crud-generator

Composer 安装命令:

composer require shehroz/crud-generator

包简介

Laravel package to generate full CRUD (controllers, models, requests, repositories, policies, migrations, seeders, and Tailwind views) with repository pattern, role-based policies, and optional API routes.

README 文档

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 --api or --both flags.
  • 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 --api or --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

统计信息

  • 总下载量: 27
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-27