norbybaru/modularize 问题修复 & 功能扩展

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

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

norbybaru/modularize

Composer 安装命令:

composer require norbybaru/modularize

包简介

Modularize Laravel application using a modular pattern

README 文档

README

Modularize helps you organize large Laravel applications into self-contained modules — each with its own controllers, models, migrations, routes, and service providers.

Instead of scattering related code across app/Http/Controllers, app/Models, and database/migrations, you group everything by feature: modules/Auth/, modules/Billing/, modules/Notifications/. Each module is independently navigable, testable, and replaceable — without changing how Laravel loads your application.

Requirements

  • PHP 8.2+
  • Laravel 10, 11, or 12

Installation

composer require norbybaru/modularize

Configuration

Publish the package configuration:

php artisan vendor:publish --provider="NorbyBaru\Modularize\ModularizeServiceProvider"

Autoloading

Add the Modules namespace to your composer.json and run composer dump-autoload:

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

Config options

The published config file (config/modularize.php) exposes the following options:

Option Default Description
enable true Autoload all modules found in root_path
root_path modules Root directory where modules are created
autoload_routes true Automatically register routes from each module's Routes/ directory
autoload_service_provider true Automatically register each module's Providers/<ModuleName>ServiceProvider.php

When enable is true, modules are automatically discovered and booted — no manual registration required.

Creating Your First Module

Generate a model with all related files in one command:

php artisan module:make:model User --module=Auth --all

This creates the following structure:

modules/
└── Auth/
    ├── Controllers/
    │   └── UserController.php
    ├── Database/
    │   ├── Factories/
    │   │   └── UserFactory.php
    │   ├── Migrations/
    │   │   └── <timestamp>_create_users_table.php
    │   └── Seeders/
    │       └── UserSeeder.php
    ├── Models/
    │   └── User.php
    └── Policies/
        └── UserPolicy.php

Command Reference

Module Management

Command Description
module:list List all existing modules

Generators

All generator commands accept --module=<name> to specify the target module and --force to overwrite an existing file. If --module is omitted, you will be prompted interactively with autocomplete.

Command Key Options Description
module:make:model -a/--all, -m/--migration, -f/--factory, -s/--seed, -c/--controller, --policy, --api, -r/--resource, -i/--invokable, -p/--pivot Generate a model; --all also creates a migration, factory, seeder, policy, and resource controller
module:make:controller --api, -r/--resource, -i/--invokable, -m/--model= Generate a controller (--api omits create and edit methods)
module:make:migration --create=, --table= Generate a migration
module:make:factory --model= Generate a model factory
module:make:seeder Generate a seeder
module:make:policy --model= Generate a policy
module:make:request Generate a form request
module:make:resource Generate an API resource
module:make:middleware Generate middleware
module:make:event Generate an event
module:make:listener Generate a listener
module:make:job Generate a job
module:make:mail Generate a mailable
module:make:notification Generate a notification
module:make:provider Generate a service provider
module:make:component Generate a view component
module:make:console Generate an Artisan command
module:make:view Generate a Blade view
module:make:test Generate a test class

Contributing

Contributions are welcome. Fork the repository, create a branch off master, and open a pull request.

License

MIT — see LICENSE.md.

norbybaru/modularize 适用场景与选型建议

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

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

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

围绕 norbybaru/modularize 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-13