PHPackages                             sugarcraft/sugar-crumbs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sugarcraft/sugar-crumbs

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sugarcraft/sugar-crumbs
=======================

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

02631PHP

Since Jun 29Pushed 1mo agoCompare

[ Source](https://github.com/sugarcraft/sugar-crumbs)[ Packagist](https://packagist.org/packages/sugarcraft/sugar-crumbs)[ RSS](/packages/sugarcraft-sugar-crumbs/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (1)

[![sugar-crumbs](.assets/icon.png)](.assets/icon.png)

[![CI](https://github.com/detain/sugarcraft/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/detain/sugarcraft/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/a6f0fe2eebf9d3a05488ab20a79abfa73b5ffb49f3ada00f923742199e8c75b5/68747470733a2f2f636f6465636f762e696f2f67682f64657461696e2f737567617263726166742f6272616e63682f6d61737465722f67726170682f62616467652e7376673f666c61673d73756761722d6372756d6273)](https://app.codecov.io/gh/detain/sugarcraft?flags%5B0%5D=sugar-crumbs)[![Packagist Version](https://camo.githubusercontent.com/7c2a1a04dd062c2a6ba7b84d40c437a2ad42d0d7147dabc46012f5bee7f169a1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7375676172636f72652f73756761722d6372756d62733f6c6162656c3d7061636b6167697374)](https://packagist.org/packages/sugarcore/sugar-crumbs)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/e78ffc83837c0d12647811a7fd1910c3cbeae04988de94bb4fd5b67e0874696a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d254532253839254135382e312d3838393262662e737667)](https://www.php.net/)

SugarCrumbs
===========

[](#sugarcrumbs)

PHP port of [KevM/bubbleo](https://github.com/KevM/bubbleo) — NavStack (navigation stack) and Breadcrumb components for terminal UIs.

Features
--------

[](#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
-------

[](#install)

```
composer require sugarcraft/sugar-crumbs
```

NavStack Quick Start
--------------------

[](#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
--------------------

[](#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"
```

### Click-Region Tracking

[](#click-region-tracking)

Attach a self-contained `Scanner` from `sugarcraft/candy-mouse` for mouse-click zone routing:

```
use SugarCraft\Crumbs\Breadcrumb;
use SugarCraft\Mouse\Scanner;

$bc = (new Breadcrumb())->withScanner(Scanner::new());

$output = $bc->render($stack);
// Each crumb is wrapped in a named zone marker: "crumb-0", "crumb-1", …

$bc->scan($output);
$zone = $bc->hit($col, $row); // returns Zone for clicked crumb-N or null

if ($zone !== null && \preg_match('/crumb-(\d+)/', $zone->id, $m)) {
    $index = (int) $m[1];
    // route click on crumb-$index to the appropriate handler
}
```

`withZoneManager()` is a deprecated back-compat wrapper that (post-Step-4) internally delegates to a Scanner. Prefer `withScanner()` directly.

Shared foundations
------------------

[](#shared-foundations)

Mouse hit-testing is self-contained via [candy-mouse](https://github.com/detain/sugarcraft-candy-mouse). The `Scanner` class handles zone registration and hit testing locally — external Manager wiring is no longer needed for mouse-only use cases. `withZoneManager()` is retained as a deprecated back-compat wrapper.

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance59

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1036e0717211b8030b83cbe729e8ba6ba442fdbd5285fb97a39d7dcfe339342?d=identicon)[detain](/maintainers/detain)

---

Top Contributors

[![detain](https://avatars.githubusercontent.com/u/1364504?v=4)](https://github.com/detain "detain (62 commits)")

### Embed Badge

![Health badge](/badges/sugarcraft-sugar-crumbs/health.svg)

```
[![Health](https://phpackages.com/badges/sugarcraft-sugar-crumbs/health.svg)](https://phpackages.com/packages/sugarcraft-sugar-crumbs)
```

###  Alternatives

[spiral/mcp-server

Spiral bridge for MCP server

551.3k2](/packages/spiral-mcp-server)[linqiao/php-addtran

查询 手机号归属地/银行卡号信息/IP地址解析 phone address ip address chinese bank number

177.0k](/packages/linqiao-php-addtran)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
