Calendar
A month calendar returning a normalized ISO YYYY-MM-DD; arrows move by day and week.
A dependency-light PHP engine for interactive, keyboard-driven terminal forms. Declare the questions with a fluent builder; the engine renders a scrollable, themeable TUI - or collects the answers headlessly from JSON and environment variables.
composer require drevops/tuiDescribe the questions with a fluent builder - text, choices, toggles and more - and call run(). Interactive on a terminal, non-interactive otherwise.
use DrevOps\Tui\Builder\Form;use DrevOps\Tui\Builder\PanelBuilder;use DrevOps\Tui\Tui;
$form = Form::create('Quick start') ->panel('order', 'New order', function (PanelBuilder $p): void { $p->text('name', 'Order name')->required(); $p->select('fruit', 'Fruit')->default('banana')->options([ 'apple' => 'Apple', 'banana' => 'Banana', 'cherry' => 'Cherry', ]); $p->select('veg', 'Vegetables')->multiple()->default(['carrot'])->options([ 'carrot' => 'Carrot', 'tomato' => 'Tomato', 'spinach' => 'Spinach', ]); $p->number('quantity', 'Quantity')->min(1)->max(99)->default(6); $p->confirm('organic', 'Organic only?')->default(FALSE); });
// Interactive on a terminal, non-interactive otherwise.$answers = (new Tui($form))->run();On a terminal
A scrollable, keyboard-driven TUI; fields group into sections that drill in to any depth, with a contextual key-hint footer and a ? help overlay.
Everywhere else
Supply the answers up front as a JSON payload and environment variables so it runs without prompting. Emits a JSON schema for agents.
The engine stays generic. Your questions and handlers live in the consumer - it collects, you apply. Open any card for the code and a recording.
A month calendar returning a normalized ISO YYYY-MM-DD; arrows move by day and week.
Yes/No toggle; arrows or Space switch, y/n set the choice directly, Enter accepts.
Browse the filesystem for a path, or several with ->multiple(); -> enters a directory, <- returns to its parent.
Integer entry accepted as an int, with optional min, max and step.
Text rendered as a mask everywhere; the accepted value stays plain for the consumer, and can be made revealable.
An acknowledgement gate; Enter or Space accepts. Unattended runs auto-acknowledge it.
Rank a list by moving items; Space picks an item up, arrows carry it, Enter accepts.
Single choice with a visible filter line; typing fuzzy-matches and ranks the labels.
Single choice from a list; arrows move, Enter accepts, long lists page around the cursor.
Free text with autocomplete over a fixed option set; suggestions fuzzy-matched and ranked.
Single-line input with a movable caret; type to insert, arrows move, Backspace deletes.
Multi-line input; Enter inserts a newline, Tab accepts, with an external-editor handoff.
An inline switch between two labelled values; arrows or Space flip, first letter sets it directly.