PHP code example of horde / tree

1. Go to this page and download the library: Download horde/tree library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

horde / tree example snippets


use Horde\Tree\Node;
use Horde\Tree\TreeBuilder;
use Horde\Tree\Renderer\ResponsiveRenderer;

$tree = (new TreeBuilder('nav'))
    ->addNode(new Node('inbox', 'Inbox', params: ['icon' => '/mail.svg', 'url' => '/mail']))
    ->addNode(new Node('unread', 'Unread (5)', parentId: 'inbox'))
    ->build();

echo (new ResponsiveRenderer())->render($tree);