AnsiKit is a zero-dependency ANSI escape helper for building terminal UIs in PHP. It features a chainable API for styles, color, and cursor control, along with useful components and utilities:

Here's a quick example of using the input component with a confirmation, and rendering a table using the package's table component (the examples folder has more complete examples):
use Ajaxray\AnsiKit\AnsiTerminal;use Ajaxray\AnsiKit\Components\Table;use Ajaxray\AnsiKit\Support\Input; $t = new AnsiTerminal();$t->clearScreen()->cursorHome(); // Single-line input$name = Input::line('What is your name? [Anonymous] ', 'Anonymous');$t->writeStyled("Hello, {$name}!\n", [AnsiTerminal::TEXT_BOLD, AnsiTerminal::FG_GREEN]); // Confirmation$proceed = Input::confirm('Do you want to enter a short bio?', true);if (!$proceed) { $t->writeStyled("Okay, skipping bio.\n", [AnsiTerminal::FG_YELLOW]); exit(0);} // Example of the Table component(new Table()) ->setHeaders('Name','Age') ->addRow('Ada', '36') ->addRow('Linus', '54') ->render();
AnsiKit features the following components and helpers to help you build UIs on the command line:
- Table component
- Banner component
- Progressbar component
- Spinner component
- Choice component
- Keypress helper
- Input helper
- And more...
💻 You can get started with AnsiKit on GitHub: ajaxray/AnsiKit
📕 The GitHub repo has an examples folder: examples