承接 dioscouri/f3-modules 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dioscouri/f3-modules

Composer 安装命令:

composer require dioscouri/f3-modules

包简介

Modules component for the F3-framework

README 文档

README

A module manager for the F3 framework

Getting Started

Add this to your project's composer.json file:

{
    "require": {
        "dioscouri/f3-modules": "dev-master"
    }
}

Then add the following two lines to your index.php file, immediately before $app->run();

// bootstap each mini-app
\Dsc\Apps::instance()->bootstrap();

// trigger the preflight event
\Dsc\System::instance()->preflight(); 

Adding Module Positions to the System

Yor front-end template probably has several custom module positions (header, footer, left, right, etc). Tell the f3-admin about them with the following code, which you should put in your apps/site/bootstrap.php

// register the template'e module positions
\Modules\Factory::registerPositions( array('promo', 'footer', 'above-content', 'below-content') );

Displaying a Module Position in your template

Add the following to your template file to render modules in the "footer" position.

<tmpl type="modules" name="footer" />

Displaying a Module Position in a view file

Use the following code to render a module position within one of your views.

echo \Modules\Factory::render( 'your_custom_position_name', \Base::instance()->get('PARAMS.0') );

Add your project's modules to the system

To add your own custom modules to the system, put them all within subfolders of your own \Modules folder, for example:

/apps/site/modules/

resulting in:

/apps/site/modules/custom_module_1/
/apps/site/modules/custom_module_2/

Then register your module folder with the system:

// register the modules path
\Modules\Factory::registerPath( $f3->get('PATH_ROOT') . "apps/site/modules/" );

Module filesystem structure

  1. Each module must have a module.json file in its document root, the contents of which is a single json object with at least a title (unique), eg:
{
    "title": "Your Custom Module"
}
  1. Each module must have a Module.php file in its document root that contains a single class. The class should be namespaced (e.g. \Your\Custom\Namespace) and the class name should be 'Module'. Finally, the class must extend \Modules\Abstracts\Module

Bootstrap your modules

All of your modules can have their own bootstrap.php file, and therefore can have their own Listeners. Put the bootstrap.php file in the root of their folder, such as:

/apps/site/modules/custom_module_1/bootstrap.php
/apps/site/modules/custom_module_2/bootstrap.php

Add custom fields to the f3-admin module-editing form

Your module's Listener can add custom html to the f3-admin module-editing form. See the core Megamenu Module for a working example:

f3-modules/src/Modules/Modules/Megamenu/Listeners/Admin.php

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 6
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL
  • 更新时间: 2014-05-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固