https://symfony.com/blog/new-in-symfony-8-1-tui-component Компонент для упрощения написания TUI приложений. use SymfonyComponentTuiEventInputEvent; use SymfonyComponentTuiInputKeybindings; use SymfonyComponentTuiTui; use SymfonyComponentTuiWidgetInputWidget; use SymfonyComponentTuiWidgetTextWidget;

$tui = new Tui();

$input = new InputWidget(); $input->setPrompt('Name: '); // widgets are event-driven: react to submit, cancel, change, selection, etc. $input->onSubmit(fn () => $tui->stop());

$tui->add(new TextWidget('Enter your name and press Enter:')); $tui->add($input); $tui->setFocus($input);

// intercept raw keystrokes (here, quit on Ctrl+C) $keys = new Keybindings(['quit' => ['ctrl+c']]); $tui->addListener(function (InputEvent $event) use ($tui, $keys) { if ($keys->matches($event->getData(), 'quit')) { $tui->stop(); } });

$tui->run(); // blocks until stop() is called; then the terminal is restored

echo 'Hello, '.$input->getValue()."!n";