Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:131004 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 01CBC1A00BC for ; Sun, 24 May 2026 17:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1779642305; bh=5T9I14r9QdUO7MnIjwJjHVLRn0hfYvZRq87AU2pVSgg=; h=From:Date:Subject:To:From; b=DxIFK4eFzrYTIuoQ6pusvwjs48KX/yyaSYAQVTn/EpkBAimnaiLkWje6JmDZAuz5P HV1A0SxVqQBdChJvD8bJ4MHbNXKliiz+/GsLQKlGoiL7CKR7EOVt1Gs3pilZRIjTAO vI5WZ2FsnEu6AF/szCj5D7mpr0upRkqOskS47pROWML3ksAqPmspXNJHTwKKX7wENz 4lJ3cLi+V1YIee6+S4YaEQkJK/giPFHau+i2myQ51Td4F+ovfN8CLE1bOpuYGEgDYM aJ5w4JIO8VZTnSyILUjNZNXGiIASVwQwlqe9W5KsC6+j4EwRHQ2V9SdeXulHzEtNkP b6eB8cuWRjjJQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E054D180050 for ; Sun, 24 May 2026 17:05:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 24 May 2026 17:05:01 +0000 (UTC) Received: by mail-vs1-f45.google.com with SMTP id ada2fe7eead31-6314a0eefb1so2774122137.2 for ; Sun, 24 May 2026 10:04:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779642296; cv=none; d=google.com; s=arc-20240605; b=klqLjwr5LzChPae4EcgGRQfNV2wtwgeHSuYuLzHitzJ1JcqvB+e64u0uJZ8hy4htKT PVuqbG2yksWoN00dNcD3Um9+GAmWQOr+d+SIMxkYNJcWNYJ5y4OvVQiZ3mx00DMYrET1 qny34IkOcPGdFX6K/XMf1k9KX2fqKbHMOygcdS1htRdUCxefJpA7UPdc0Ftfwv1FgHK5 64oDP66Foejstjr9r5MZwIxdzftBQt3CVi2NbS4263hL+j8UekYqCwNakcReefKXxKf5 SXvrapM4qLtgwpF97KcRxnB2Dp4sWcA4O99bB1wZE/uQjWiy7Vf89kY7oRl0fAWg0wRY K2Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=5T9I14r9QdUO7MnIjwJjHVLRn0hfYvZRq87AU2pVSgg=; fh=5KvmJ5K5QBymFDNCdtgpPKEwgSxqOQnCzLzHVTYb8GE=; b=Rn9OiAEDB7ndZyoVLq0d3efOAhEr4x5rBk05Z6mvivQrFcBccBoNO4/V3iOnSExD6H kbKHiO86c6URfZwFs9S9QoUlHqT62YvPFMVatkKwls7qjDDe7z6B431qT2oyc6/0ALYp b76hR3YUarsBVR6+GHkQLbqXvlz4+4634lpxTRBuEaMkuhSnSIcmuCvhsJuas4HnSNS6 6FM8LjjfCmdXnbRzQQ1SGe+sw3E+VeheYFN1c7ZMAjzJ08cYtue9oZu/8MGeXpx53NXu xjSOCpnt4uQh1AyEmhEP5fzJUGIm0XNxsdCkRF4RQW/GPNyNf5R/8e6gFmeLGSrNGAzW 5uIw==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779642296; x=1780247096; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=5T9I14r9QdUO7MnIjwJjHVLRn0hfYvZRq87AU2pVSgg=; b=k0xFY+jagb+w9sZFUhm2YToAH301utCMI7EP8gYzuyq0apvE/Ea4D5rM3YQ5Eqc18A bETTGWAvL7ReRuXpx9vGCHl/mfT9XBx0B4pdTJ2lGCIn++qhmbL0tYs4Nv/KJZNBItHx A9TCnrlfUZ8ovUMpF9cUGrvMEuWa4qqhytiXRAeAK3Z8hE+bZeBpt+P78UCidoVuheSJ FatUXaOe9I7a1Ni8zHD/FBMtajLLVpKJh3e8WMr8O8aY7fE9Ciyguh73BUMtxMayUrtE 8Mf/RtsfOjw9tdzThSTJBLaFPGy9blckM1vDQ/k+RDORKlbgu4WkDqVYbSLXMmL0S/Fx 2nEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779642296; x=1780247096; h=to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5T9I14r9QdUO7MnIjwJjHVLRn0hfYvZRq87AU2pVSgg=; b=P+cqRCmA2nZLBCKbwWRf0P12yZyKWa3CfGYjz04gssg2Xd4K870HtPHp+yFu2quKbp lO7QDoTUDoB1/AjfRaK7jw2FJLiXN2cJk4/KqBKciDv/DpIq2Hgw6c7D4BALGpcfPYms v1ACBxj5gFvRF1vFRVznXaFd7xbmUOtBc8vSUsFfST7fCvrmB5g9TG9Vj6Lekag2rdFk K1DOCM+yAuLyDwlQqZiKUpKjbAVh2mDwT2urEViRN2O0BxPOBqJIKl1XLv4XqOtHvwDM vFuHVkZDmuJ8jLKWTA3vg93UM3og/RIN7mFkUmbJDUZlwrg3Bdfp4L3pknVjKFH+PWVZ DtRQ== X-Gm-Message-State: AOJu0YxUnKsehX5WGjUWqQ+IiM4yetNxJp+SVV9qCzbeyJ3499wspIJb anEYa3Mn9eN6MlfoQ/2vMWq7tniAtLtXXfnrZJlg8tNWBw6eUBSJsYX3kZ+wj1CwCor+h4Y9DL6 jedLdNYdzDQkDPyk4koBp3kIhMZdgxR6fZQ== X-Gm-Gg: Acq92OEVngwEB89HEAh9lDQJacjoIX5r10D70LuFRAIjwf86j4TTiVPn3ag8gFTlDKA eX4yOxA7hQbnAzH9RinyHFyHDYS63/g/ylUnUrpXxPWrMG2jkfAqGzknYzPaTdTl7owIpRmbnIZ dA7l2RYiQWMzccGzPW7VoirHnHY/Qno9qrR+RpGYaqTxzkJiCisK9p7iKUKztun09pXz7l4HJmI OZFDaP2oNuBVxcZXzDgooK+tAN6j9DMM64xR+7IFNPfTDvjFjds/0Ig9E+MJgh7qFZZOAITWZKY Lf0g8Y5cQmhRBS/Pxg9vmuTIq33pCUBt2HRFKtyzWUbcm8KLLFaZXFs4k7JSYUaFxjfqLFpXXiX fvMuL9242JpX2HECAMZKx5I51riLglkjhKZOygylzq6gxjPGU6XyhUciMLw== X-Received: by 2002:a05:6102:1494:b0:633:e67f:b7f with SMTP id ada2fe7eead31-67c84ad903cmr5031900137.25.1779642295753; Sun, 24 May 2026 10:04:55 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Sun, 24 May 2026 22:49:43 +0545 X-Gm-Features: AVHnY4I8C_hpPltOyAAhZVnPn4gjjeziTUMWupPNF0WkNJmJOAziARYC6VIeZ7g Message-ID: Subject: [PHP-DEV] [Discussion] Native terminal helpers for PHP CLI To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000dd9f3c0652934200" From: prateekbhujelpb@gmail.com (Pratik Bhujel) --000000000000dd9f3c0652934200 Content-Type: text/plain; charset="UTF-8" Hi internals, I have been experimenting with a small PHP extension for native terminal helpers: https://github.com/prateekbhujel/php-terminal The goal is to expose a small cross-platform CLI terminal layer for the pieces that are currently awkward to normalize in userland, especially on Windows: - checking whether stdin/stdout/stderr are TTYs - reading terminal size - enabling/restoring raw mode safely - reading a single key with normalized names - writing directly to stdout/stderr This started from a practical issue with prompt-style PHP CLIs. Laravel Prompts, for example, currently cannot use its normal interactive prompt flow on Windows because the backend depends on Unix-style terminal behavior. I opened a proof-of-concept integration here: https://github.com/laravel/prompts/pull/242 The extension is still alpha, and I am not proposing it for core right now. I mainly want feedback on whether this API shape makes sense from a PHP CLI/runtime point of view, and whether this is better kept as PECL/ecosystem work first. Initial release with Windows builds: https://github.com/prateekbhujel/php-terminal/releases/tag/v0.1.0 If this would be better discussed on internals-win first, I am happy to move it there. I am mainly looking for feedback on API shape, naming, Windows behavior, and missing primitives before taking it further. Thanks, Pratik --000000000000dd9f3c0652934200 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi internals,

I have been experimenting with a smal= l PHP extension for native terminal
helpers:

https://github.com/prateekbhujel/php-= terminal

The goal is to expose a small cross-platform CLI termin= al layer for the
pieces that are currently awkward to normalize in userl= and, especially on
Windows:

- checking whether stdin/stdout/stder= r are TTYs
- reading terminal size
- enabling/restoring raw mode safe= ly
- reading a single key with normalized names
- writing directly to= stdout/stderr

This started from a practical issue with prompt-style= PHP CLIs. Laravel
Prompts, for example, currently cannot use its normal= interactive prompt
flow on Windows because the backend depends on Unix-= style terminal
behavior. I opened a proof-of-concept integration here:
https://githu= b.com/laravel/prompts/pull/242

The extension is still alpha, and= I am not proposing it for core right
now. I mainly want feedback on whe= ther this API shape makes sense from a
PHP CLI/runtime point of view, an= d whether this is better kept as
PECL/ecosystem work first.

Initi= al release with Windows builds:

https://github.com/prateekbhujel/= php-terminal/releases/tag/v0.1.0

If this would be better discuss= ed on internals-win first, I am happy to
move it there. I am mainly look= ing for feedback on API shape, naming,
Windows behavior, and missing pri= mitives before taking it further.

Thanks,
Pratik
--000000000000dd9f3c0652934200--