CLI presentation helpers
StatusLine, Banner, Section, Stage, HelpText. Library-only โ no Symfony Console requirement. Drop into any Composer project to give CLI output the same look as the rest of the stack.
composer require sugarcraft/candy-kit
use SugarCraft\Kit\{StatusLine, Banner};
echo Banner::title('CandyApp', 'v0.1.0'), "\n\n";
echo StatusLine::info ('connecting to https://example.com'), "\n";
echo StatusLine::success('done in 0.4s'), "\n";
echo StatusLine::warn ('disk almost full'), "\n";
echo StatusLine::error ('connection refused'), "\n";
success / error / warn / info / prompt static helpers โ glyph + message styled per the active theme.--version output. Title and subtitle are single display lines โ embedded escapes, newlines and control bytes are stripped.Sprinkles\Style objects keyed by status level. Theme::ansi() ships the colourful palette; Theme::detect() downgrades it to what the output can show via candy-core's ColorProfile::detect() โ no escape bytes when STDOUT is not a tty, colour dropped but bold kept under NO_COLOR on a terminal, full colour under CLICOLOR_FORCE / FORCE_COLOR. Every presenter called without a theme uses Theme::detect(); apply the same downgrade to a preset with withColorProfile().header() label + fill rule, bare rule(), indented subHeader(). An explicit width is a hard cap: an over-long label is cut with โฆ rather than overflowing.step(), subStep(), and subStepWithProgress() (bar or spinner).--help page: USAGE, an optional description, and titled two-column key/description sections. Wraps to width (default 80, null = never wrap): long descriptions continue at the description column, and switch to a stacked layout when the key column leaves fewer than 16 cells.| Class | Method | Description |
|---|---|---|
| StatusLine | success(msg, ?theme) | Render a success line |
| StatusLine | error(msg, ?theme) | Render an error line |
| StatusLine | warn(msg, ?theme) | Render a warning line |
| StatusLine | info(msg, ?theme) | Render an info line |
| StatusLine | prompt(msg, ?theme) | Render a prompt line |
| Banner | title(title, subtitle = '', ?theme, ?border) | Bordered title banner (control bytes stripped from caller text) |
| Section | header(label, ?theme, leftPad = 2, ?width = 80, rune = 'โ') | Label + fill rule; a non-null width is a hard cap (long labels end in โฆ) |
| Section | rule(?theme, ?width = 80, rune = 'โ') / subHeader(label, ?theme, indent = 4, ?width = 80, rune = 'ยท') | Bare divider / indented nested heading |
| Stage | step() / subStep() / subStepWithProgress() | Numbered step, sub-step, and sub-step with a bar or spinner |
| HelpText | render(usage, sections, description = '', ?theme, ?width = 80) | Full --help page; wraps to width, null = never wrap, width < 1 throws |
| HelpText | renderRows(rows, ?theme, ?width = 80) | One two-column block; stacked layout below MIN_DESCRIPTION_WIDTH (16) cells |
| Theme | ansi() / detect(?env, ?stream) / plain() | Colourful palette / palette downgraded to the stream's ColorProfile / no styling |
| Theme | withColorProfile(ColorProfile $profile) | Downgrade any theme to a colour profile |
VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.