Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

sugarcraft/candy-kit

Repository files navigation

candy-kit

CandyKit

CI codecov Packagist Version License PHP

demo

composer require sugarcraft/candy-kit

PHP port of charmbracelet/fang β€” opinionated CLI presentation helpers that turn ordinary command- line output into something that matches the rest of the SugarCraft stack. CandyKit is library-only β€” drop it into any Composer project, no Symfony Console requirement.

use SugarCraft\Kit\StatusLine;
use SugarCraft\Kit\Banner;
use SugarCraft\Kit\Theme;
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";

Components

  • Theme β€” palette of Sprinkles\Style objects keyed by status level (success / error / warn / info / prompt / accent / muted). Theme::ansi() ships a sensible default; bring your own theme by passing styles to the constructor.
  • StatusLine β€” success / error / warn / info static helpers returning a glyph + message string styled per the active theme.
  • Banner β€” render a bordered title block with optional subtitle, rounded by default. Useful for app intros / --version output.
  • Logo β€” ASCII-art logo renderer with Logo::sugarcraft() built-in preset and Logo::fromAscii($art) for custom art. Chain ->withColor($hex) to apply foreground color.
  • Section β€” styled section with title and body content, themeable.
  • Stage β€” multi-section presentation container.
  • HelpText β€” formatted help output.
  • Frame β€” full-screen application chrome: a double-line box that fills the terminal exactly (Frame::new()->withTitle($bar) ->withStatus($bar)->render($body, $cols, $rows)), with a centred title bar, dividers, and a status bar. Normalises the body to a constant line count and pads ANSI-width-aware so it never overflows the terminal β€” safe for a TEA program whose frame-diff renderer owns the screen.

Demos

CLI page

cli-page

Logo

logo

Section

section

Stage

stage

Test

cd candy-kit && composer install && vendor/bin/phpunit

Snapshot tests

Presenter output is pinned via candy-testing's assertGoldenAnsi golden-file snapshots. Any change to the ANSI slide output must be intentional β€” re-record the fixture with --update-golden to accept a new canonical render.

About

🎁 PHP port of πŸŽͺ fang β€” CLI presentation helpers: StatusLine βœ“βœ—βš i, Banner, Section, Stage step, HelpText & 6 stock themes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /