Build, parse, traverse, and print tree structures.

Alto Tree builds, parses, traverses, prints, manipulates, and compares hierarchies of files and directories.

<?php
use Alto\Tree\Printer\TreePrinter;
use Alto\Tree\TreeBuilder;

$tree = TreeBuilder::fromPaths([
    'project/src/App.php',
    'project/tests/AppTest.php',
], 'project');

echo (new TreePrinter())->print($tree);

Introduction

Trees

  • Building: create trees from paths, directories, Git, or custom providers.
  • Parsing: read tree-shaped text back into objects.
  • Printing: filter, sort, and format tree output.
  • Traversal: collect information or visit nodes with custom behavior.
  • Editing: split, merge, append, flatten, and rebuild trees.
  • Comparing: find and print added, removed, and unchanged paths.