sugarcraft/sugar-crumbs

PHP port of KevM/bubbleo — NavStack and Breadcrumb components. Push/pop navigation stack with hierarchical breadcrumb rendering for terminal UIs.

Maintainers

Package info

github.com/sugarcraft/sugar-crumbs

pkg:composer/sugarcraft/sugar-crumbs

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0 2026-05-07 01:29 UTC

This package is not auto-updated.

Last update: 2026-05-07 14:55:32 UTC


README

sugar-crumbs

CI codecov Packagist Version License PHP

SugarCrumbs

PHP port of KevM/bubbleo — NavStack (navigation stack) and Breadcrumb components for terminal UIs.

Features

  • NavStack — hierarchical navigation state with push/pop/peek operations
  • Breadcrumb renderer — renders the current navigation path as a clickable-looking breadcrumb string
  • Shell — combines NavStack + Breadcrumb into a single component
  • Pure renderer — breadcrumb output is just strings; works with any TUI framework
  • No external dependencies — pure PHP 8.1+

Install

composer require sugarcraft/sugar-crumbs

NavStack Quick Start

use SugarCraft\Crumbs\NavStack;

$stack = new NavStack();

// Push navigation items (each has a title + optional data)
$stack->push('Home');
$stack->push('Settings');
$stack->push('Display');

// Current item
echo $stack->current()->title;   // "Display"
echo $stack->depth();            // 3

// Pop back
$popped = $stack->pop();
echo $popped->title;             // "Display"
echo $stack->current()->title;   // "Settings"

Breadcrumb Rendering

use SugarCraft\Crumbs\Breadcrumb;

$bc = new Breadcrumb();
$bc->setSeparator('');        // default " › "
$bc->setMaxWidth(60);            // truncate if needed

// Render from NavStack
$stack = new NavStack();
$stack->push('Home');
$stack->push('Settings');
$stack->push('Display');

echo $bc->render($stack);  // "Home › Settings › Display"

License

MIT