emlynwest/setui
Composer 安装命令:
composer require emlynwest/setui
包简介
UI module for FuelPHP nested sets
README 文档
README
Module to provide basic user interfaces for FuelPHP's nested sets model.
Install instructions
Just run composer require emlynwest/setui.
Or
Add the following to your composer.json:
{
"require": {
"stevewest/setui": "dev-master"
},
}
Then just run a composer update!
After that all you will need to do is enable the module in your FuelPHP application's config file.
Custom module location
If your application uses a non-standard module location then you can add the below
to your composer.json to ensure the module is installed in the correct place.
(Make sure you keep the {$name}.)
{
"extra": {
"installer-paths": {
"my/custom/path/{$name}": ["stevewest/setui"]
}
}
}
Usage
Menu rendering
Using the SetUI\Menu class you can render a nested set model into a list. The constructor
takes an optional config array that can be used to control the behaviour of how the
set is rendered. Below is the default config for each item and an explanation of
what they can be used for.
<?php $config = [ // This is each leaf of the tree, by default it has a link and a list of children 'leafView' => 'setui::setui/leaf', // This is the list of children for each leaf 'listView' => 'setui::setui/list', // This is the top level container, it can be used for adding style around the list 'containerView' => 'setui::setui/container', // If not set to null will be treated as an instance of Theme for loading views 'themeInstance' => null, // Property name of the model to load the leaf name from 'nameProperty' => 'name', // Set to true to display the root node of the tree 'includeRoot' => false, // What to prepend to the URL before it is passed to Uri::create() 'uriPrefix' => '', // URI string that denotes the currently active node path (eg "parent/child/grandchild") 'activePath' => '', ];
To render a set just create a new instance of SetUI\Menu and call the build()
method.
<?php $menu = new \SetUI\Menu($config); $set = Model_Tree::forge()->set_tree_id(1)->root()->get_one(); // $tree contains the top level View object $tree = $menu->build($set);
Note on path generation
Path names are generated using nested sets' path() method, to ensure you are getting
the correct paths then make sure your nested set's tree config has the title_field
setting set to the correct column name. While SetUI does not care what this is it is
often best to use a URL friendly property, such as one generated with the slug observer.
JavaScript
The module also includes some basic javascript to allow a slightly nicer user interaction.
To enable this you will want to symlink the files in assets to the appropriate asset
folders. While you can copy the files, doing so means you will manually have to update
the assets when the module is updated.
Once the JS is included in the page it will automatically collapse non-active branches and allow branches to be opened and closed.
jQuery 1.7 or higher is required.
Testing
Currently the module is not unit tested due to the complications of testing FuelPHP v1 modules outside of an application.
Acknowledgements
Triangle icon by Elegant Themes from www.flaticon.com is licensed by CC BY 3.0
emlynwest/setui 适用场景与选型建议
emlynwest/setui 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 3, 最近一次更新时间为 2017 年 12 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「admin」 「ui」 「fuelphp」 「fuel」 「nested sets」 「user interface」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 emlynwest/setui 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 emlynwest/setui 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 emlynwest/setui 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
Salesforce Marketing Cloud Fuel SDK for PHP
Salesforce Marketing Cloud Fuel SDK for PHP
Autoloader.
Analysis module for finding problematical shop data.
Fork of the Salesforce Marketing Cloud Fuel SDK for PHP
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-27