{"id":26796441,"url":"https://github.com/peterujah/hierarchical","last_synced_at":"2025-08-30T09:36:53.367Z","repository":{"id":57038180,"uuid":"412212981","full_name":"peterujah/hierarchical","owner":"peterujah","description":"Hierarchical - Light, simple  PHP and mysql Hierarchy data and organization chart","archived":false,"fork":false,"pushed_at":"2022-10-13T09:38:32.000Z","size":139,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-27T19:32:08.960Z","etag":null,"topics":[],"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/peterujah.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":"2021-09-30T20:12:02.000Z","updated_at":"2023-12-30T20:49:29.000Z","dependencies_parsed_at":"2022-08-24T00:51:07.580Z","dependency_job_id":null,"html_url":"https://github.com/peterujah/hierarchical","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/peterujah/hierarchical","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fhierarchical","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fhierarchical/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fhierarchical/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fhierarchical/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterujah","download_url":"https://codeload.github.com/peterujah/hierarchical/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fhierarchical/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272833294,"owners_count":25000870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-03-29T18:18:41.809Z","updated_at":"2025-08-30T09:36:53.318Z","avatar_url":"https://github.com/peterujah.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Hierarchical \n\nHierarchies represent relations between people or other types of related entities. The hierarchy structure determines which entities are in command of other entities.\n\nHierarchies can be stored in databases using table records that express what entities are below or above in the hierarchy tree.\n\nThis class can retrieve a hierarchy tree structure from a MySQL database table to easily visualize using the Google Organisation Chart API, Array or HTML.\n\n\n![alt text](https://github.com/peterujah/Hierarchical/blob/c0fcb5bc6be51763ae3a04d04e56694d682b7ec5/Screen%20Shot%202021-10-01%20at%206.12.50%20AM.png)\n\n## Installation\n\nInstallation is super-easy via Composer:\n```md\ncomposer require peterujah/hierarchical\n```\n\n# USAGES\n\nHierarchical can be use as an array, html or google organizations chart\n\n  ```php \n  use Peterujah\\NanoBlock\\Hierarchical;\n  $hierarchy = new Hierarchical($conn, Hierarchical::LIST);\n  $hierarchy = new Hierarchical($conn, Hierarchical::HTML);\n  $hierarchy = new Hierarchical($conn, Hierarchical::CHART);\n  ```\n  \n  Assign new user to a position\n  \n  ```php\n   $hierarchy-\u003eadd(\"foo22\", \"Foo\")-\u003eunder(\"vy7735\");\n   ```\n  \n  Dump array \n  \n   ```php \n   $hierarchy = new Hierarchical($conn, Hierarchical::LIST);\n   var_export($hierarchy-\u003erun(\"Peter\", \"vy7735\"));\n   ```\n   \n   Display on google Organisation chart\n  \n  ```javascript\n  google.charts.load('current', {packages:[\"orgchart\"]});\n\tgoogle.charts.setOnLoadCallback(drawChart);\n\tfunction drawChart() {\n      var data = new google.visualization.DataTable();\n      data.addColumn('string', 'Name');\n      data.addColumn('string', 'Manager');\n      data.addColumn('string', 'ToolTip');\n      data.addRows(\u003c?php echo $hierarchy-\u003erun(\"Peter\", \"vy7735\");?\u003e);\n      var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));\n      chart.draw(data, {'allowHtml':true});\n}\n```\n\nInitalisation options `new Hierarchical($conn, Hierarchical::CHART)`\n\n| Options         | Description                                                                         |\n|-----------------|-------------------------------------------------------------------------------------|\n| LIST            | Retrieve result as an array                                                         |\n| HTML            | Retrieve result in HTML list                                                        |\n| CHART           | Retrieve result in json data for google chart                                       |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterujah%2Fhierarchical","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterujah%2Fhierarchical","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterujah%2Fhierarchical/lists"}