jamacio/module-laravel
Composer 安装命令:
composer require jamacio/module-laravel
包简介
Laravel module with auto-discovery support. Organize all Laravel main folders in a single module for easier maintenance and discovery.
README 文档
README
Use the command below to install the package via Composer. After installation, follow the steps to create modules in the app/Code/YourModuleName folder:
composer require jamacio/module-laravel
Module Laravel
Module Laravel is a package designed to streamline Laravel's core folder structure by consolidating Routes, Views and Migrations into a single module folder. This approach simplifies maintenance and improves discoverability for modular applications.
Overview
In traditional Laravel applications, core folders are distributed across multiple directories (e.g., routes/, resources/views/, database/migrations/, etc.). This package centralizes these components into a unified module structure under a dedicated folder (e.g., app/Code/YourModuleName). Key advantages include:
- Simplified Maintenance: Centralize module-specific assets for easier management.
- Improved Discoverability: Quickly locate and manage module-specific resources.
- Auto-Discovery Support: Automatically registers service providers using Laravel’s package auto-discovery feature.
Features
- Organized Folder Structure: Groups Routes, Views and Migrations into a single module folder.
- Auto-Discovery: Utilizes Laravel’s auto-discovery to register service providers without manual configuration.
- Dependency Management: Supports module dependency ordering through an XML configuration file (
module.xml). - Modular Routing and Views: Allows module-specific routes and views to override or extend default Laravel functionality.
- Dynamic Resource Loading: Automatically loads migrations for each module.
Folder Structure
After Laravel installation, your module folder structure will look like this:
app/
└── Code/
└── YourModuleName/
├── module.xml
├── Routes/
│ ├── web.php
│ └── api.php
├── Views/
│ └── index.blade.php
├── Database/
│ └── Migrations/
│ └── 2021_01_01_000000_create_example_table.php
├── Controllers/
│ └── YourModuleController.php
This structure organizes all module-specific assets under a single folder, simplifying management and maintenance. Each subfolder serves a specific purpose:
- module.xml: Contains metadata and dependencies for the module.
- Routes: Includes route files (
web.phpandapi.php) for module-specific routes. - Views: Stores Blade templates for the module.
- Database: Contains subfolders for migrations.
- Controllers: Houses controllers for managing HTTP requests.
Module Configuration
The module must reside within the folder: app/Code/YourModuleName, and it must include a module.xml file with the same name as the folder. Below is an example:
<?xml version="1.0" ?> <config> <module name="SampleModule"/> </config>
Module Dependency Sequence
If you need a module to execute after another, you can define the sequence in the module.xml file as shown below:
<?xml version="1.0" ?> <config> <module name="SampleModule"/> <sequence> <module name="SampleModuleOld"/> </sequence> </config>
This ensures that SampleModule will execute after SampleModuleOld.
jamacio/module-laravel 适用场景与选型建议
jamacio/module-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jamacio/module-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jamacio/module-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-25