定制 arrahmouni/crud-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

arrahmouni/crud-generator

Composer 安装命令:

composer require arrahmouni/crud-generator

包简介

Generate crud for laravel modules

README 文档

README

Laravel CRUD Generator License

A powerful CLI tool to generate complete CRUD operations with translations, permissions, and modular architecture support.

📦 Features

  • One-Command CRUD Generation
  • API or Web CRUD – Choose between API-only (admin panel API) or web CRUD (with optional views)
  • Multilingual Support (Model translations + migration translations)
  • Modular Architecture (Works with nwidart/laravel-modules)
  • Optional Components:
    • Soft Delete & Disabled Status
    • Admin CRUD Controller (web or API)
    • Front (user) API Controller
    • Permissions System
    • Factories & Seeders
    • Form Requests
    • Blade Views (web CRUD only)
  • API Controller Structure – Controllers under Api/Admin (admin) and Api/Front (user-facing)
  • Custom Stub Support
  • Automatic Route Generation (web.php or api.php)
  • Permission Seeding

🚀 Installation

  1. Install via Composer:
composer require arrahmouni/crud-generator
  1. Publish configuration and stubs:
php artisan vendor:publish --provider="CrudGeneratorServiceProvider" --tag=config
php artisan vendor:publish --provider="CrudGeneratorServiceProvider" --tag=stubs

🛠 Configuration

Edit config/crud.php to customize:

return [
    'stub_path' => resource_path('stubs/'), // Custom stub path
    // Add other configuration parameters
];

🎯 Basic Usage

Generate a full CRUD structure with interactive prompts:

php artisan create:crud ModelName ModuleName

Example - Create a Product CRUD in Catalog module:

php artisan create:crud Product Catalog

🔧 Command Workflow

First question: Do you want to create an API or a web CRUD?

  • API CRUD – Admin panel API only (no views). Routes go to api.php. Admin API controller uses BaseApiCrudController (permissions, soft delete, disabled, bulk actions).
  • Web CRUD – Admin panel with optional Blade views. Routes go to web.php. Optional front (user) API controller in Api/Front.

Then you'll be asked:

  • Soft Delete
  • Disabled Status
  • Translations
  • Migrations
  • Factories
  • Seeders
  • Requests
  • Admin CRUD controller (web controller in Admin/ or API controller in Api/Admin/ depending on API vs web)
  • Front API controller (user-facing API in Api/Front/)
  • Paginate API controller(s)
  • Permissions
  • Views (web CRUD only; not asked for API CRUD)

📂 Generated Structure

Web CRUD (when web is chosen):

ModuleName/
├── Entities/
│   └── ModelName.php
├── Http/
│   ├── Controllers/Admin/
│   │   └── ModelNameController.php
│   ├── Controllers/Api/
│   │   ├── Admin/          (optional, when admin API crud)
│   │   │   └── ModelNameController.php
│   │   └── Front/          (optional, front API controller)
│   │       └── ModelNameController.php
│   ├── Services/
│   └── Requests/
├── Resources/
│   ├── ModelNameResource.php
│   └── views/...           (optional)
├── Database/
│   ├── migrations/
│   ├── factories/
│   └── seeders/
└── Routes/
    ├── web.php             (admin web routes)
    └── api.php             (admin API and/or front API routes)

API CRUD (when API is chosen): same as above but no views; admin CRUD controller is generated in Api/Admin/ (extends BaseApiCrudController). The service does not include the getDataTable method (used only for web admin).

🔄 Post-Creation Steps

If permissions were created:

  1. Add the translation key to the seeder file in the ability_group section
  2. Add the model icon in the Permission module config
  3. Add any additional permissions in the Permission module config

Web CRUD:

  • Add translation keys in admin::dashboard (aside_menu: {model}_management)
  • Add translation keys in admin::cruds
  • Add translation keys in admin::datatables

API CRUD:

  • Register admin API routes in the module api.php if needed (middleware, prefix)

Sync permissions:

php artisan module:seed Permission

Run migrations:

php artisan module:migrate ModuleName

🛡 Service Provider

The CrudGeneratorServiceProvider handles:

  • Command registration
  • Stub path configuration
  • Package asset publishing
  • Configuration management

📜 License

This package is open-source software licensed under the MIT license.

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Happy CRUD Generation! 🚀

arrahmouni/crud-generator 适用场景与选型建议

arrahmouni/crud-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 300 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「generator」 「modules」 「crud」 「laravel」 「ar-rahmouni」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 arrahmouni/crud-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 arrahmouni/crud-generator 我们能提供哪些服务?
定制开发 / 二次开发

基于 arrahmouni/crud-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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