jminayat/modules-laravel
Composer 安装命令:
composer create-project jminayat/modules-laravel
包简介
modular laravel applications
README 文档
README
jminayat/modules-laravel is a package for the administration of your laravel application in modules. compatible with Laravel version 5.5 .
Installation
Install the package through the composer.
composer require jminayat/modules-laravel
You need to load the module folder since it does not load automatically. You can autoload your modules using psr-4.
Edit main composer file, and add:
{
"autoload": {
"psr-4": {
"App\\": "app/",
"Modules\\": "modules/"
}
}
}
Do not forget to execute composer dump-autoload .
You can publish the Migrations.
php artisan vendor:publish --provider="JMinayaT\Modules\ModulesServiceProvider" --tag="migrations"
After the migration has been published, you can create the table of modules by executing the migrations:
php artisan migrate
You can publish the Config file (it's optional).
php artisan vendor:publish --provider="JMinayaT\Modules\ModulesServiceProvider" --tag="config"
When published, the config/modules.php Config file contains:
<?php return [ /* * Name of the table to use * default value but you may easily change it to any table you like. */ 'table_name' => 'modules', ];
Usage
Creating A Module
To create a new module, simply run the following command:
php artisan module:create <module-name>
<module-name>- Replace with the name of the desired module.module description- Write the description of the module created.
To automatically add controller, model and migration when creating a new module use: -c -d -m
php artisan module:create <module-name> -c -d -m
-cor--controller- Create controller.-dor--model- Create model.-mor--migration- Create migration.
Folder Structure
modules/
├── Blog/
├── Controllers/
├── Database/
├── migrations/
├── Models/
├── Resources/
├── Assets/
├── lang/
├── views/
├── Route/
├── web.php
├── api.php
├── module.json
Artisan Commands
Note that the command names use "test" as the name of the example module
module:active
activate | disable module, use true or false.
php artisan module:active test true
module:create
create a new module.
php artisan module:create test
options
-cor--controller- Create controller.-dor--model- Create model.-mor--migration- Create migration.
module:delete
delete module.
php artisan module:delete test
module:install
Install module from zip file.
php artisan module:install var/this-path/test.zip
module:list
show list of all modules.
php artisan module:list
module:make-controller
Create a new module controller.
php artisan module:make-controller test TestController
module:make-middleware
Create a new module middleware class.
php artisan module:make-middleware test TestMiddleware
module:make-request
Create a new module request class.
php artisan module:make-request test TestRequest
module:make-model
Create a new module model.
php artisan module:make-model test TestModel
options
-mor--migration- Create migration.
module:make-migration
Create a new module migration.
php artisan module:make-migration test create_tests_table
module:make-seeder
Create a new module seeder class.
php artisan module:make-seeder test testSeeder
module:make-factory
Create a new module factory class.
php artisan module:make-factory test testFactory
module:make-test
Create a new module test class.
php artisan module:make-test test userTest
module:make-policy
Create a new module policy class.
php artisan module:make-policy test testPolicy
module:publish
Publish module zip file.
php artisan module:publish test
module:up
Up config file module json.
php artisan module:up test
module:migrate
Migrate database for all modules.
php artisan module:migrate
For migrate a specific module to use:
php artisan module:migrate test
module:rollback
Rollback the last module database migration.
php artisan module:rollback
For rollback a specific module to use:
php artisan module:rollback test
module:seed
Module Seed the database with records.
php artisan module:sedd
For seed a specific module to use:
php artisan module:seed test
Facade Methods
Get all modules.
Module::all();
Get a specific module.
Module::get('test');
Get all active modules.
Module::getEnabled();
Get all disabled modules.
Module::getDisabled();
Check the specified module. If it exists, will return true, otherwise false.
Module::has('test');
Count all modules.
Module::count();
Install a module using the zip file.
Module::install('path/file.zip');
Migrate database the specified module.
Module::moduleMigrate('test');
Rollback database the specified module.
Module::moduleRollback('test');
Migrate the database to all modules
Module::moduleMigrateAll();
Rollback database to all modules.
Module::moduleRollbackAll();
Module Methods
get entity from a specific module.
$module = Module::get('test');
Get module name in studlycase.
$module->studlyName();
Get the status of the module if it is active or disabled.
$module->status();
Enable the specified module.
$module->active();
Enable the specified module.
$module->disable();
Delete the specified module.
$module->delete();
Get module Path.
$module->getPath();
Get module Json file.
$module->getModuleJson();
License
The MIT License (MIT). Please see License File for more information.
jminayat/modules-laravel 适用场景与选型建议
jminayat/modules-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 191 次下载、GitHub Stars 达 3, 最近一次更新时间为 2017 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「modules」 「laravel」 「modular」 「jminayat」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jminayat/modules-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jminayat/modules-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jminayat/modules-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This is Paymorrow module for OXID eShop.
Silverstripe content blocks module
Analysis module for finding problematical shop data.
yii2 swiper slider
An interactive tour through the TYPO3 backend.
Enterprise-Grade Modular Architecture for Laravel Applications - A powerful Laravel package that revolutionizes application development with robust Service Repository Pattern, Dynamic Module Management, and 50+ Artisan commands for scalable, maintainable applications.
统计信息
- 总下载量: 191
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-29