# [PHP DEV] [Discussion] Native terminal helpers for PHP CLI

- Thread: https://externals.io/message/132526
- Original archive: https://news-web.php.net/php.internals/132526
- Started by Pratik Bhujel on 2026-09-17T15:30:39+00:00
- Messages: 2
- RFC: Io\Terminal (Under discussion) — https://externals.io/rfc/io_terminal.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #132526 — Pratik Bhujel — 2026-09-17T15:30:39+00:00

URL: https://externals.io/message/132526#132526

Ah got it, thanks for pointing out the 8.7 timeline Larry.

On the PECL to core transition, I personally lean toward sooner if people
see value in it, mostly so internals can help shape the API early before
conventions get locked in userland. For anyone curious to test or poke
around the code, the repository is here:
https://github.com/prateekbhujel/php-terminal
 Any PRs, feedback, or design critiques are more than welcome.

Curious what you and others think on whether this makes sense as an RFC
direction for 8.7, or if there are particular areas you would want adjusted
first?

Pratik

---

## #132528 — tim@bastelstu.be — 2026-09-17T17:03:42+00:00

URL: https://externals.io/message/132526#132528 · In reply to: #132526

Hi


> Curious what you and others think on whether this makes sense as an RFC
> direction for 8.7, or if there are particular areas you would want 
> adjusted
> first?

I don't understand much about the problem you're tackling, so I can't 
meaningfully comment on if the API makes sense on a "high level" domain 
specific perspective. However for the API to become a first class 
citizen some changes will need to be made:

1. With the new polling API introducing the Io namespace, the 
functionality should likely be provided as Io\Terminal. Grouping it 
under Io makes sense to me and avoids reserving another top-level name.

2. Classes are not namespaces: Static methods that are not named 
constructors should be free-standing functions. Thus 
Io\Terminal\enable_ansi(), Io\Terminal\set_title(), etc. Alternatively 
since they almost all seem to take the "file descriptor" as the first 
argument, they could also be instance methods on an Io\Terminal\Terminal 
class that receives the terminal handle in the constructor. I leave it 
up to the domain experts to decide what makes more sense.

3. The enums should be unbacked. A backed enum is almost always the 
wrong design decision, since there is rarely a single canonical and 
obviously correct scalar representation.

Best regards
Tim Düsterhus
