Hi internals,

I would like to formally propose the Io\Terminal API for PHP 8.7:

https://wiki.php.net/rfc/io_terminal

This follows the earlier php-internals discussion about native
terminal helpers and the API work that came out of it.

The RFC proposes a small Io\Terminal API in ext/standard for terminal
sessions, native terminal size queries, raw mode with safe
restoration, normalized key input, and hidden input.

The existing reference implementation is ext-terminal, distributed
through PIE/Packagist as prateekbhujel/php-terminal:
https://github.com/prateekbhujel/php-terminal

A draft php-src implementation is available here:
https://github.com/php/php-src/pull/23941

It follows the reduced core API rather than copying the full
ext-terminal 1.x surface.

The proposed core API uses Time\Duration for timeout parameters, does
not expose a public constructor, and leaves compatibility aliases,
environment-based size fallbacks, and convenience APIs out of the
initial core proposal.

The earlier internals discussion and the Symfony Console/TUI
integration have helped narrow the proposal to the parts that require
native cross-platform support. Some of the earlier replies were
accidentally split into separate archive threads, so the RFC collects
the full prior discussion history in one place.

I would appreciate feedback on the proposed API and semantics before voting.

Thanks,
Pratik

Reply via email to