PHP Classes

PHP MySQL Hierarchical Tree: Retrieve and display hierarchy trees from MySQL

Recommend this page to a friend!

  Author Author  
Picture of Ujah Chigozie peter
Name: Ujah Chigozie peter <contact>
Classes: 17 packages by
Country: Nigeria Nigeria
Age: 31
All time rank: 240513 in Nigeria Nigeria
Week rank: 38 Up1 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 8x

  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This class can retrieve and display hierarchy trees from MySQL.

It can query a MySQL database table that contains records of nodes of a tree of elements that form a hierarchy.

The class can also return a JSON data structure with the hierarchy information that is suitable to pass to Google Chart API so it can render the hierarchy tree as an image that can be displayed in the current Web page.


PHP Hierarchical

Hierarchical is a simple php & mysql program to arrange users based on their rankings, it can also be used to represent data in a chain ranking. This libery will work very well with Google Organisation chart

alt text


Installation is super-easy via Composer:

composer require peterujah/hierarchical


Hierarchical can be use as an array, html or google organizations chart

  use Peterujah\NanoBlock\Hierarchical;
  $hierarchy = new Hierarchical($conn, Hierarchical::LIST);
  $hierarchy = new Hierarchical($conn, Hierarchical::HTML);
  $hierarchy = new Hierarchical($conn, Hierarchical::CHART);

Dump array

   $hierarchy = new Hierarchical($conn, Hierarchical::LIST);
   var_export($hierarchy->run("Peter", "vy7735"));

Display on google Organisation chart

  google.charts.load('current', {packages:["orgchart"]});
	function drawChart() {
      var data = new google.visualization.DataTable();
      data.addColumn('string', 'Name');
      data.addColumn('string', 'Manager');
      data.addColumn('string', 'ToolTip');
      data.addRows(<?php echo $hierarchy->run("Peter", "vy7735");?>);
      var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
      chart.draw(data, {'allowHtml':true});

Initalisation options new Hierarchical($conn, Hierarchical::CHART)

| Options | Description | |-----------------|-------------------------------------------------------------------------------------| | LIST | Retrieve result as an array | | HTML | Retrieve result in HTML list | | CHART | Retrieve result in json data for google chart |

  Classes of Ujah Chigozie peter  >  PHP MySQL Hierarchical Tree  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog (1)  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: PHP MySQL Hierarchical Tree
Base name: hierarchical
Description: Retrieve and display hierarchy trees from MySQL
Version: 1.0.0
PHP version: 5
License: GNU General Public License (GPL)
All time users: 139 users
All time rank: 9145
Week users: 0 users
Week rank: 62 Equal
  Groups   Rate classes User ratings   Applications   Files Files  

Group folder image Algorithms Numerical and statistical algorithms View top rated classes
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Graphics Colors, images, charts and picture formats View top rated classes
Group folder image Web services Web data clipping, SOAP or XML-RPC clients and servers View top rated classes
Group folder image Data types Modeling and manipulating data types View top rated classes

  Innovation Award  
PHP Programming Innovation award nominee
February 2022
Number 4
Hierarchies represent relations between people or other types of related entities. The hierarchy structure determines which entities are in command of other entities.

Hierarchies can be stored in databases using table records that express what entities are below or above in the hierarchy tree.

This class can retrieve a hierarchy tree structure from a MySQL database table to easily visualize using the Google Charts API.

Manuel Lemos

  User ratings  
Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Files folder imagedata (3 files)
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file package.json Data Auxiliary data
Accessible without login Plain text file Doc. Read me

  Files folder image Files  /  data  
File Role Description
  Accessible without login Plain text file conn.php Aux. Auxiliary script
  Accessible without login Plain text file hierarchical_data.sql Data Auxiliary data
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  src  
File Role Description
  Plain text file Hierarchical.php Class Class source

Install with Composer Install with Composer - Download Download all files: hierarchical.tar.gz
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.