{"id":36621225,"url":"https://github.com/wxxiong6/tree","last_synced_at":"2026-01-12T09:23:46.506Z","repository":{"id":57083055,"uuid":"68898825","full_name":"wxxiong6/tree","owner":"wxxiong6","description":"使用递归把有规则数据，处理成树形数据结构。适用场景菜单、权限、分类等功能。","archived":false,"fork":false,"pushed_at":"2020-07-08T02:01:22.000Z","size":38,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-06T15:54:23.266Z","etag":null,"topics":["tree","tree-data"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wxxiong6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-22T08:03:32.000Z","updated_at":"2022-04-16T02:00:44.000Z","dependencies_parsed_at":"2022-08-24T14:58:26.109Z","dependency_job_id":null,"html_url":"https://github.com/wxxiong6/tree","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/wxxiong6/tree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxxiong6%2Ftree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxxiong6%2Ftree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxxiong6%2Ftree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxxiong6%2Ftree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wxxiong6","download_url":"https://codeload.github.com/wxxiong6/tree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wxxiong6%2Ftree/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28337705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["tree","tree-data"],"created_at":"2026-01-12T09:23:44.283Z","updated_at":"2026-01-12T09:23:46.486Z","avatar_url":"https://github.com/wxxiong6.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/wxxiong6/tree.svg?branch=master)](https://travis-ci.org/wxxiong6/tree)\n[![GitHub forks](https://img.shields.io/github/forks/wxxiong6/tree.svg)](https://github.com/wxxiong6/tree/network)\n[![Packagist](https://img.shields.io/packagist/v/wxxiong6/tree.svg)](https://packagist.org/packages/wxxiong6/tree)\n![Packagist](https://img.shields.io/packagist/dt/wxxiong6/tree)\n\n## tree\n- 使用递归把数据构造成树形结构数据\n- 常用于菜单、权限、分类等功能实现\n- 避免多次查询数据库,使用php来处理\n  \n## Installation\n```shell\ncomposer require wxxiong6/tree\n```\n\n\n## Usage\n```PHP\n//设置主键、parent标识名称 子节点名称\nTree::setConfig($primary = '', $parentId = '', $child = '');\n//生成tree\nTree::makeTree($data);\n```\n\n运行结果\n\n```\nArray\n(\n    [0] = Array\n   (\n      [id] = 1\n       [city] = 中国\n       [parent_id] = 0\n        [child] = Array\n         (\n                 [0] = Array\n                      (\n                             [id] = 2\n                            [city] = 北京\n                             [parent_id] = 1\n                             [child] = Array\n                                (\n                                 [0] = Array\n                                         (\n                                             [id] = 3\n                                            [city] = 北京市\n                                            [parent_id] = 2\n                                            [child] = Array\n                                                (\n                                                   [0] = Array\n                                                       (\n                                                            [id] = 4\n                                                            [city] = 东城区\n                                                            [parent_id] = 3\n                                                        )\n\n                                                   \n                                                )\n\n                                        )\n\n                                )\n\n                        )\n\n                    [1] = Array\n                        (\n                            [id] = 11\n                            [city] = 上海\n                            [parent_id] = 1\n                            [child] = Array\n                                (\n                                    [0] = Array\n                                        (\n                                            [id] = 12\n                                            [city] = 上海市\n                                            [parent_id] = 11\n                                        )\n\n\n                                )\n\n                        )\n\n                )\n\n        )\n\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwxxiong6%2Ftree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwxxiong6%2Ftree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwxxiong6%2Ftree/lists"}