raza9798/laravel-core-modules 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

raza9798/laravel-core-modules

Composer 安装命令:

composer require raza9798/laravel-core-modules

包简介

Laravel package for modular development, providing a structured approach to organizing models, controllers, migrations, and policies under a clean namespace like Core/. It simplifies scaffolding and enhances code separation for improved project structure.

README 文档

README

laravel-core-modules package.

📦 Laravel Core Modules

A lightweight Laravel package to generate and manage modular application structure using Artisan-based scaffolding.

It helps you organize Laravel applications into feature-based modules containing:

  • Controllers
  • Models
  • Migrations
  • Seeders
  • Factories
  • Requests
  • Policies

🚀 Installation

1. Install via Composer

$ composer require raza9798/laravel-core-modules
$ php artisan core-modules:install

2. Register Service Provider (if auto-discovery is disabled)

// config/app.php

'providers' => [
    Raza9798\LaravelCoreModules\CoreModulesServiceProvider::class,
],

3. Setup Modules Autoload (IMPORTANT)

Add this to your Laravel application's composer.json:

"autoload": {
    "psr-4": {
        "App\\": "app/",
        "Modules\\": "Modules/"
    }
}

Then run:

composer dump-autoload

⚙️ Configuration (Optional)

Publish config file:

php artisan vendor:publish --tag=laravel-core-modules-config

📁 Default Module Structure

When a module is created:

Modules/
└── Inventory/
    ├── app/
    │   ├── Http/
    │   │   └── Controllers/
    │   ├── Models/
    │   ├── Policies/
    ├── database/
    │   ├── migrations/
    │   ├── seeders/
    │   ├── factories/
    ├── routes/
    ├── tests/
    │   ├── Feature/
    │   ├── Unit/

🧑‍💻 Available Commands

📌 Create Module

php artisan module:create {name}

Example:

php artisan module:create Inventory

📌 Generate Module Files

php artisan module:make

Flow:

  • Select existing module OR create new one
  • Select artifact preset
  • Generate required files

📌 Artifact Options

When running module:make:

Select artifacts to generate:

✔ API Resource
✔ Database
✔ Custom

API Resource generates:

  • Controller
  • Model
  • Migration
  • Seeder
  • Factory

Database generates:

  • Model
  • Migration
  • Seeder
  • Factory

Custom generates:

  • Controller
  • Model
  • Migration
  • Seeder
  • Factory
  • (More coming)

🧪 Example Usage

Step 1: Create a module

php artisan module:create Inventory

Step 2: Generate files inside module

php artisan module:make

Example flow:

Select module:
> Inventory

Select artifacts:
> API Resource

Enter name:
> ItemMaster

Result:

Modules/Inventory/
├── app/Http/Controllers/ItemMasterController.php
├── app/Models/ItemMaster.php
├── database/migrations/...
├── database/seeders/...

⚠️ Important Notes

  • Requires PSR-4 autoloading for Modules\ namespace
  • Run composer dump-autoload after setup
  • Laravel base controller may be used inside modules

🤝 Contributing

Feel free to fork and improve the package.

📜 License

MIT License © Raza9798

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固