PHP port of DaltonSW/bubbleup — floating alert notification component for terminal UIs. Alerts float to the top of your TUI like bubbles in soda.
- 6 positions: TopLeft, TopCenter, TopRight, BottomLeft, BottomCenter, BottomRight
- 4 alert types: Error, Warning, Info, Success — each with distinct styling
- Dynamic width: fixed or auto-sizing between minWidth and maxWidth
- Symbol sets: NerdFont (icons), Unicode (boxed), ASCII (plain text)
- Auto-dismiss: duration-based expiry support
- Multiple alerts: queue of toasts rendered in order
- Pure renderer: outputs ANSI strings; works with any TUI framework
composer require sugarcraft/sugar-toastuse SugarCraft\Toast\{Position, Toast, ToastType};
$toast = Toast::new(50) // max width 50
->withPosition(Position::TopRight)
->withDuration(10.0); // seconds
// Add alerts
$toast = $toast->alert(ToastType::Success, 'File saved!');
$toast = $toast->alert(ToastType::Error, 'Connection failed');
// Render into a viewport
$bg = str_repeat("background content\n", 20);
echo $toast->View($bg);ToastType::Error
ToastType::Warning
ToastType::Info
ToastType::SuccessPosition::TopLeft
Position::TopCenter
Position::TopRight
Position::BottomLeft
Position::BottomCenter
Position::BottomRight