定制 codrasil/tree 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

codrasil/tree

Composer 安装命令:

composer require codrasil/tree

包简介

PHP Library to generate a hierarchical tree list from array.

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

PHP Library to generate a hierarchical tree list from array. Ideal for creating menus, sidebars, and any nested resources.


Requirements

  • php: >=7.1

Installation

$ composer require codrasil/tree
{
    "require": {
        "codrasil/tree": "^1.*"
    }
}

Usage

use Codrasil\Tree\Tree;

$menus = [
  ['id' => 'menu:user', 'text' => 'Users', 'order' => 2, 'children' => [ ... ]],
  ['id' => 'menu:blog', 'text' => 'Blogs', 'order' => 1],
  ['id' => 'submenu:blog:category', 'parent' => 'menu:blog', 'text' => 'Blog Categories', 'order' => 1],
];

$options = [
  'key' => 'id',
  'parent' => 'parent',
  'children' => 'children',
];

$tree = new Tree($menus, $options);

$tree->build();

print_r($tree->get());
/*
output:

Array
(
    [menu:blog] => Codrasil\Tree\Branch Object
        (
            [key:protected] => menu:blog
            [parent:protected] => root
            [node:protected] => Array
                (
                    [name] => menu:blog
                    [parent] => root
                    [order] => 1
                    [children] => Array
                        (
                            [submenu:blog:category] => Codrasil\Tree\Branch Object
                                (
                                    ...
                                )
                        )
                    [left] => 2
                    [right] => 3
                )
        )
    [menu:user] => Codrasil\Tree\Branch Object ( ... )
*/

You may also run the demo inside the tests folder via cloning this repository, then starting a php server on the tests/ folder.

cd /path/to/codrasil/tree
php -S localhost:8080 -t tests/

Screenshot of demo server


Documentation

coming soon


License

The Codrasil/Tree PHP library is open-source software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固