codeurx/modular
Composer 安装命令:
composer require codeurx/modular
包简介
Codeurx Modular is simply a package for Laravel to help you create and manage modules.
关键字:
README 文档
README
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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codeurx/modular 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This is Paymorrow module for OXID eShop.
Analysis module for finding problematical shop data.
yii2 swiper slider
An interactive tour through the TYPO3 backend.
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
Yii2 module to manage website content. Kind of a CMS...
统计信息
- 总下载量: 128
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-12