sugarcraft/sugar-stickers

PHP port of 76creates/stickers — Lipgloss utility components. FlexBox (CSS flexbox-like responsive grid layout) and Table (sortable, filterable data table with column definitions).

Maintainers

Package info

github.com/sugarcraft/sugar-stickers

pkg:composer/sugarcraft/sugar-stickers

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

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

This package is not auto-updated.

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


README

sugar-stickers

CI codecov Packagist Version License PHP

SugarStickers

PHP port of 76creates/stickers — Lipgloss utility building blocks. Provides FlexBox layout and Table components for terminal UIs.

Features

FlexBox

  • CSS flexbox-like responsive grid layout for terminal UIs
  • Direction: row (horizontal) or column (vertical)
  • Justify content: start/center/end/space-between/space-around
  • Align items: start/center/end/stretch
  • Gap between items
  • Ratio-based sizing — items with grow ratios fill available space
  • Wrap — items wrap to next line/column when they exceed available space

Table

  • Sortable columns — click to sort by any column, ascending/descending
  • Filterable — filter rows by cell content
  • Configurable columns — title, width, alignment, formatter
  • Cell styling — per-column ANSI style support
  • Cursor tracking — get current row/cell on selection

Install

composer require sugarcraft/sugar-stickers

FlexBox Quick Start

use SugarCraft\Stickers\Flex\{FlexBox, FlexItem};

$box = FlexBox::row(
    FlexItem::new('Panel A')->withRatio(1),
    FlexItem::new('Panel B')->withRatio(2),
    FlexItem::new('Panel C')->withRatio(1),
)->withGap(1);

echo $box->render(80, 24);

Table Quick Start

use SugarCraft\Stickers\Table\{Table, Column};

$table = new Table();
$table->addColumn(Column::make('Name', 20));
$table->addColumn(Column::make('Age', 5)->withAlign('right'));
$table->addColumn(Column::make('City', 15));

$table->addRow(['Alice', 30, 'NYC']);
$table->addRow(['Bob',   25, 'LA']);
$table->addRow(['Carol', 35, 'Chicago']);

$table->sortBy(0);  // sort by Name column
$table->filter('a'); // filter rows

echo $table->render();

License

MIT