承接 tebru/tree 相关项目开发

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

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

tebru/tree

Composer 安装命令:

composer require tebru/tree

包简介

A PHP tree data structure. Allows for referencing nodes by unique key.

README 文档

README

Build Status

Tree Data Structure

This library aims to provide an object oriented way to create a tree data structure. Each node has a user defined unique id by which it is referenced.

Installing the project

Run composer require tebru/tree:1.0.*

Creating the tree

Creating a tree is really easy. All you have to do is instantiate it: $tree = new Tree(); This will create the tree object and create a root node to act upon.

Create a node

There are many options for creating a node.

  • Creating a node appended to the root node can be done like $tree->createNode('node');
  • If you want to add this node to a different node you can do so like $tree->createNode('node2', 'node');
  • You have the option to add arbitrary data to a node by doing $tree->createNode('a_category', null, 'Foo Category');
  • Finally, you can specify the position your node should appear in the parent's children like $tree->createNode('node', null, null, 10);
    • You may not specify an position for an index that does not already exist
    • Setting the position will bump all existing nodes back 1 space starting with the node at the specified index

Remove a node

Just pass in the node id: $tree->removeNode('node'); This will remove that node and all of its children from the tree.

Move a node

This is also easy. Just specify the node id of the node you wish to move and the node id of its new parent: $tree->moveNode('node', 'newNodeId');

Testing

Run tests by running phpunit from the root directory.

Versioning

This project uses semantic versioning [http://semver.org] for versioning.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固