codeurx/modular 问题修复 & 功能扩展

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

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

codeurx/modular

Composer 安装命令:

composer require codeurx/modular

包简介

Codeurx Modular is simply a package for Laravel to help you create and manage modules.

README 文档

README

License Build Status Latest Stable Version Scrutinizer Code Quality

Codeurx Modular is simply a package for Laravel to help you create and manage modules.

Install

To install through Composer, by run the following command:

composer require codeurx/modular

Autoloading

By default the module classes are not loaded automatically. You can autoload your modules using psr-4. For example:

{
  "autoload": {
    "psr-4": {
      "App\\": "app/",
      "App\\Modules\\": "app/Modules/"
    },
    "files": [
        "app/Modules/helpers/helpers.php"
    ]
  }
}

Tip: don't forget to run composer dump-autoload afterwards.

run the following command to publish modules table migrations:

php artisan vendor:publish --provider="Codeurx\Modular\ModularServiceProvider" --tag="migrations"

after that run the command:

php artisan migrate

Usage

Creating A Module

To create a new module, simply run the following command:

php artisan modular:make <module-name>
  • <module-name> - Replace with the name of the desired module.

Folder Structure

app/Modules/
      ├── Users/
          ├─ Database/
             ├─ Migrations/
          ├─ Http/
             ├─ Controllers/
                ├─ UsersController.php
             ├─ Models/
                ├─ UsersModel.php
          ├─ Providers/
             ├─ UsersServiceProvider.php
          ├─ Resources/
             ├─ views/
                ├─ index.blade.php
          ├─ Routes/
             ├─ web.php 
      

You can access the url example for Users module by typing :

http://sever/users/ or  http://sever/public/users/

For Dummy data:

http://sever/users/users-test or  http://sever/public/users/users-test

Deleting A Module

To delete a specific module, simply run the following command:

php artisan modular:delete <module-name>
  • <module-name> - Replace with the name of the desired module to be deleted.

Tip: if the module does not exist you will be asked if you want to create it.

Listing All the Modules

To list the modules just run the following command:

php artisan modular:list

Creating A Module Migration

To create a migration for a specific module just run the following command:

php artisan modular:make-migration <module-name> --table=<table-name>
  • <module-name> - Replace with the name of the desired module.
  • <table-name> - optional field, replace it with a disired name of table.

if you don't give the option --table the table name will take the name of the module by default.

Migrating Database for all modules

php artisan modular:migrate

Migrating Database for specific module

php artisan modular:migrate <module-name>

Creating a new Controller for specific module

php artisan modular:make-controller <module-name> <controller-name>
  • <module-name> - Replace with the name of the desired module.
  • <controller-name> - Replace with the controller name.

For example :

  php artisan modular:make-controller users TestController

or

  php artisan modular:make-controller users Test/TestController

Tip: if you typed the second command the folder structure will be like below :

app/Modules/
      ├── Users/
          ├─ Database/
             ├─ Migrations/
          ├─ Http/
             ├─ Controllers/
                ├─ Test 
                   ├─ TestController.php
                ├─ UsersController.php
             ├─ Models/
                ├─ UsersModel.php
          ├─ Providers/
             ├─ UsersServiceProvider.php
          ├─ Resources/
             ├─ views/
                ├─ index.blade.php
          ├─ Routes/
             ├─ web.php 
      

And for the routes you should add a line like this :

<?php

/*
|--------------------------------------------------------------------------
| Users Module Routes
|--------------------------------------------------------------------------
|
| All the routes related to the Users module have to go in here. 
|
*/

Route::get('/', 'UsersController@index');
Route::get('/users-test', 'UsersController@UsersTest');
Route::get('/test', 'Test\TestController@index');

Creating a new model for specific module

php artisan modular:make-model <module-name> <model-name>
  • <module-name> - Replace with the name of the desired module.
  • <model-name> - Replace with the model name.

For example :

  php artisan modular:make-model users TestModel

or

  php artisan modular:make-model users Test/TestModel

Tip: if you typed the second command the folder structure will be like below :

app/Modules/
      ├── Users/
          ├─ Database/
             ├─ Migrations/
          ├─ Http/
             ├─ Controllers/
                ├─ UsersController.php
             ├─ Models/
                ├─ Test 
                   ├─ TestModel.php
                ├─ UsersModel.php
          ├─ Providers/
             ├─ UsersServiceProvider.php
          ├─ Resources/
             ├─ views/
                ├─ index.blade.php
          ├─ Routes/
             ├─ web.php 
      

Credits

About Amir Ali Salah

I'm a Tunisian FullStack Web Developer. For the moment i work for GIS (Gate Informatic Systems), you can visit My Website for more Informations.

License

The MIT License (MIT). Please see License File for more information.

codeurx/modular 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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